Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package phy1;
- import java.util.Scanner;
- /**
- *
- * @author ascs
- */
- public class Phy1 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.println("What is Number Of Charge");
- double k = 9000000000.0 ; // its coloumb constant
- double mc = 1E-6*1E-6; //its transfer from mirco to cloumb but its squre value
- int x = input.nextInt();
- switch(x){
- case 1:System.out.println("That is not valied no Charge , i cant calculat any Result");
- break;
- case 2:
- System.out.println("What is the value of Charge (1) in micro coulum");
- double ch21=input.nextDouble();
- System.out.println("What is the value of Charge (2) in micro coulum");
- double ch22=input.nextDouble();
- System.out.println(" What Is The Distance Between Them in meter");
- double r2=input.nextDouble();
- double kqq2=k*ch21*ch22; double rr2=r2*r2;
- double f2=kqq2/rr2;
- double f22= f2*mc;
- System.out.println("The Force Bet Two Charges = " + f22);
- System.out.println("");
- System.out.println("");
- System.out.println("DO you want to calculat the Electric Field ");
- System.out.println(" Press (1) to Ok");
- System.out.println("Prss (2) to not");
- int xx=input.nextInt();
- if(xx==1){
- System.out.println("Plese Give The Distance bet any Charge to The Point "+
- "You Need Get Electric Field There");
- double disef= input.nextDouble();
- System.out.println("Give me The Angle in Degree");
- double degreeofef= input.nextDouble(); // degree of angle as input user
- System.out.println("");
- System.out.println("");
- System.out.println("Select The Negtive Or Postive Of The two Charges");
- System.out.println("");
- System.out.println("");
- System.out.println("Two Charge are Negtive Press >> (1)");
- System.out.println("Two Charge are Postive Press >> (2)");
- System.out.println("Q(1) Postive , Q(2) Negative >> Press (3)");
- System.out.println("Q(1) Negative , Q(2) Postive >> Press (4)");
- double mosa3ed1= k*ch21;
- double mosa3ed2= k*ch22;
- double ef1=mosa3ed1/rr2;
- double ef2=mosa3ed2/rr2;
- double sin= Math.sin(degreeofef) ;
- double cos= Math.cos(degreeofef) ;
- double ef1sin=ef1*sin;
- double ef2sin=ef2*sin;
- double ef1cos=ef1*cos;
- double ef2cos=ef2*cos;
- int xxx= input.nextInt();
- switch (xxx){
- case 1:
- double ef2total= ef1sin+ef2sin;
- System.out.println("The Magnitude Of Electric Field = " + "-" + ef2total) ;
- System.out.println("The Dirction in The Negtive Y axix") ;
- break;
- case 2:
- double ef2totall= ef1sin+ef2sin;
- System.out.println("The Magnitude Of Electric Field = " + ef2totall) ;
- System.out.println("The Dirction in The Postive Y axix") ;
- break;
- case 3:
- double ef2totals= ef1cos+ef2cos;
- System.out.println("The Magnitude Of Electric Field = " + "-" + ef2totals) ;
- System.out.println("The Dirction in The Negtive x axix") ;
- break;
- case 4:
- double ef2totalss= ef1cos+ef2cos;
- System.out.println("The Magnitude Of Electric Field = " + ef2totalss) ;
- System.out.println("The Dirction in The Postive x axix") ;
- break;
- default: System.out.println("You Know You are blind i need just 1 or 2 .. 4 Only Reopen The Program Again :D ");
- break;
- }
- }else{
- System.out.println(" Ry7tene Ya A5e HHHH :D ");
- }
- break;
- case 3:
- System.out.println("What is the value of Charge (1) in micro coulum");
- double ch31=input.nextDouble();
- System.out.println("What is the value of Charge (2) in micro coulum");
- double ch32=input.nextDouble();
- System.out.println("What is the value of Charge (3) in micro coulum");
- double ch33=input.nextDouble();
- break;
- case 4:
- System.out.println("What is the value of Charge (1) in micro coulum");
- double ch41=input.nextDouble();
- System.out.println("What is the value of Charge (2) in micro coulum");
- double ch42=input.nextDouble();
- System.out.println("What is the value of Charge (3) in micro coulum");
- double ch43=input.nextDouble();
- System.out.println("What is the value of Charge (4) in micro coulum");
- double ch44=input.nextDouble();
- break;
- default: System.out.println("I Cant Calculate any result Sorry its More Than i could efford :D");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment