AhmedKorwash

Phy 1

Jan 2nd, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.18 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package phy1;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author ascs
  13.  */
  14. public class Phy1 {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.         Scanner input = new Scanner(System.in);
  21.        
  22.         System.out.println("What is Number Of Charge");
  23.        
  24.          double k  = 9000000000.0 ; // its coloumb constant
  25.          double mc = 1E-6*1E-6; //its transfer from mirco to cloumb but its squre value
  26.         int x = input.nextInt();
  27.                
  28.         switch(x){
  29.        
  30.             case 1:System.out.println("That is not valied no Charge , i cant calculat any Result");
  31.                 break;
  32.             case 2:
  33.             System.out.println("What is the value of Charge (1) in micro coulum");
  34.                 double ch21=input.nextDouble();
  35.                 System.out.println("What is the value of Charge (2) in micro coulum");
  36.                 double ch22=input.nextDouble();
  37.             System.out.println(" What Is The Distance Between Them in meter");
  38.                 double r2=input.nextDouble();
  39.                 double kqq2=k*ch21*ch22; double rr2=r2*r2;
  40.                 double f2=kqq2/rr2;
  41.                 double f22= f2*mc;
  42.                 System.out.println("The Force Bet Two Charges = " + f22);
  43.                 System.out.println("");
  44.                 System.out.println("");
  45.                
  46.                
  47.                 System.out.println("DO you want to calculat the Electric Field ");
  48.                 System.out.println(" Press (1) to Ok");
  49.                 System.out.println("Prss (2) to not");
  50.                 int xx=input.nextInt();
  51.                
  52.                 if(xx==1){
  53.                 System.out.println("Plese Give The Distance bet any Charge to The Point "+
  54.                         "You Need Get Electric Field There");
  55.                 double disef= input.nextDouble();
  56.                
  57.                 System.out.println("Give me The Angle in Degree");
  58.                 double degreeofef= input.nextDouble(); // degree of angle as input user
  59.                
  60.                 System.out.println("");
  61.                 System.out.println("");
  62.                
  63.                 System.out.println("Select The Negtive Or Postive Of The two Charges");
  64.                 System.out.println("");
  65.                 System.out.println("");
  66.                 System.out.println("Two Charge are Negtive  Press >> (1)");
  67.                 System.out.println("Two Charge are Postive Press >> (2)");
  68.                 System.out.println("Q(1) Postive , Q(2) Negative >> Press (3)");
  69.                 System.out.println("Q(1) Negative , Q(2) Postive >> Press (4)");
  70.                
  71.                 double mosa3ed1= k*ch21;
  72.                 double mosa3ed2= k*ch22;
  73.                 double ef1=mosa3ed1/rr2;
  74.                 double ef2=mosa3ed2/rr2;
  75.                
  76.                 double sin= Math.sin(degreeofef) ;
  77.                 double cos= Math.cos(degreeofef) ;
  78.                
  79.                 double ef1sin=ef1*sin;
  80.                 double ef2sin=ef2*sin;
  81.                 double ef1cos=ef1*cos;
  82.                 double ef2cos=ef2*cos;
  83.                
  84.                 int xxx= input.nextInt();
  85.                 switch (xxx){
  86.                     case 1:
  87.                         double ef2total= ef1sin+ef2sin;
  88.                          System.out.println("The Magnitude Of Electric Field = " + "-" + ef2total) ;
  89.                          System.out.println("The Dirction in The Negtive Y axix") ;
  90.                         break;
  91.                     case 2:
  92.                         double ef2totall= ef1sin+ef2sin;
  93.                         System.out.println("The Magnitude Of Electric Field = " + ef2totall) ;
  94.                         System.out.println("The Dirction in The Postive Y axix") ;  
  95.                         break;
  96.                     case 3:
  97.                         double ef2totals= ef1cos+ef2cos;
  98.                         System.out.println("The Magnitude Of Electric Field = " + "-" + ef2totals) ;
  99.                          System.out.println("The Dirction in The Negtive x axix") ;
  100.                         break;
  101.                     case 4:
  102.                     double ef2totalss= ef1cos+ef2cos;
  103.                         System.out.println("The Magnitude Of Electric Field = " + ef2totalss) ;
  104.                          System.out.println("The Dirction in The Postive x axix") ;
  105.                         break;
  106.                    default: System.out.println("You Know You are blind i need just 1 or 2 .. 4 Only Reopen The Program Again :D ");
  107.                        break;
  108.                        
  109.                 }
  110.                
  111.                 }else{
  112.                 System.out.println(" Ry7tene Ya A5e HHHH :D ");
  113.                 }
  114.                
  115.                 break;
  116.             case 3:
  117.                 System.out.println("What is the value of Charge (1) in micro coulum");
  118.                double ch31=input.nextDouble();
  119.                System.out.println("What is the value of Charge (2) in micro coulum");
  120.                double ch32=input.nextDouble();
  121.                System.out.println("What is the value of Charge (3) in micro coulum");
  122.                double ch33=input.nextDouble();
  123.                 break;
  124.             case 4:
  125.                 System.out.println("What is the value of Charge (1) in micro coulum");
  126.                 double ch41=input.nextDouble();
  127.                 System.out.println("What is the value of Charge (2) in micro coulum");
  128.                 double ch42=input.nextDouble();
  129.                 System.out.println("What is the value of Charge (3) in micro coulum");
  130.                 double ch43=input.nextDouble();
  131.                 System.out.println("What is the value of Charge (4) in micro coulum");
  132.                 double ch44=input.nextDouble();
  133.                
  134.                 break;
  135.             default: System.out.println("I Cant Calculate any result Sorry its More Than i could efford :D");
  136.                 break;
  137.        
  138.        
  139.         }
  140.    
  141.    
  142.    
  143.     }
  144.    
  145. }
Advertisement
Add Comment
Please, Sign In to add comment