Directed for: Dr.
Jad Abbass By Mohammad Abbass Hellani ID:81130086
I.
import [Link]; public class gln { public static void main(String[]args) { Scanner scan=new Scanner([Link]); int m,g,mg; [Link]("Enter the number of miles: "); m=[Link](); [Link]("Enter the gallons of fuel used: "); g=[Link](); mg= m/g; [Link]("Miles per gallon: "+mg); } }
II.
import [Link]; public class str { public static void main(String [] args) { Scanner scan=new Scanner([Link]); double p,d,t; int q; [Link]("Enter the unit price: "); p=[Link](); [Link]("Enter the quantity: "); q=[Link](); [Link]("Enter the discount %: "); d=[Link](); t=(double) ((p*q)-(d/100)*p*q); [Link]("The client should pay: "+t+" unit price"); } }
III.
import [Link]; public class sale { public static void main(String[]args){ Scanner scan=new Scanner([Link]); int m,t,w,th; double sal=0,totsal=0,tax=0; [Link]("Please enter the time m=[Link](); if(m==4) { sal=sal+7*7; } if(m>4) { sal=sal+(7*7)+(double)(m-4)*8.4; } [Link]("Please enter the time t=[Link](); if(t==4) { sal=sal+7*7; } if(t>4) { sal=sal+7*7+(double)(t-4)*8.4; } [Link]("Please enter the time w=[Link](); if(w==4) { sal=sal+7*7; } if(w>4) { sal=sal+7*7+(double)(w-4)*8.4; } [Link]("Please enter the time th=[Link](); if(th==4) { sal=sal+7*7; } if(th>4) { sal=sal+7*7+(double)(th-4)*8.4; } tax=sal*0.03; you left on Monday:");
you left on Tuesday:");
you left on Wednesday:");
you left on Thursday:");
totsal=sal-tax; [Link]("Your total weekly salary is "+sal+" $"); [Link]("The tax in your salary is "+tax+" $"); [Link]("Your net salary is "+totsal+" $"); } }