1 / 2100%
// CSE 110 : <Class #> / <meeting days and times>
// Assignment : <assignment #>
// Author : <name> & <studentID>
// Description : <of the file contents>
import java.util.Scanner;
public class Assignment02 {
public static void main(String[] args) {
// to take inputs need to make a object of
// Scanner class
Scanner s=new Scanner(System.in);
// take inputs as per defined in Question
System.out.println("Length of Project:");
double length_of_road_project=s.nextDouble();
System.out.println("Number of Lanes:");
int no_of_lanes=s.nextInt();
System.out.println("Depth of Asphalt(in inches):");
int depth_of_asphalt=s.nextInt();
System.out.println("Days to complete Project:");
int days_to_complete_project=s.nextInt();
// calculate the truckloads,spotlights
// ,conducit pipes and crew members
double
truckload=Math.round((no_of_lanes*length_of_road_project*5280*12*(double)depth_o
f_asphalt/12*150)/10000);
int spotlights = 0;
if(no_of_lanes==1) {
spotlights=(int)length_of_road_project*3;
}
if(no_of_lanes==2) {
spotlights=(int)length_of_road_project*4;
}
if(no_of_lanes==3) {
spotlights=(int)length_of_road_project*5;
}
int conducit_pipes=(int)((double)length_of_road_project*5280)/24;
int crew_members=(int)
Math.round((50*length_of_road_project*no_of_lanes)/days_to_complete_project);
// print these material we calculated above
System.out.println("==== Amount of Material Needed ======");
System.out.print("Truckload of Asphalt :");
System.out.println(truckload);
System.out.print("Spotlights :"); System.out.println(spotlights);
System.out.print("Conduit Pipes :"); System.out.println(conducit_pipes);
System.out.print("Crew members needed :");
System.out.println(crew_members);
// now here to calculate the cost of material and print it
System.out.println("=== Cost of Materials ========");
int cost_of_Asphalt=(int) (truckload*1000);
int cost_of_spotlights=spotlights*25000;
int cost_of_conducit_pipes=conducit_pipes*500;
int cost_of_labour=crew_members*25*8*days_to_complete_project;
System.out.print("Cost of Asphalt : $");
System.out.println(cost_of_Asphalt);
System.out.print("Cost of Spotlights : $");
System.out.println(cost_of_spotlights);
System.out.print("Cost of Conduit pipes : $");
System.out.println(cost_of_conducit_pipes);
System.out.print("cost of Labour : $");
System.out.println(cost_of_labour);
System.out.println("=== Total Amount ========");
// print total amount by just adding all the cost
int total_amount=cost_of_Asphalt + cost_of_spotlights +
cost_of_conducit_pipes + cost_of_labour;
System.out.print("Total costof Project :$");
System.out.println(total_amount);
}
}
Powered by TCPDF (www.tcpdf.org)
Students also viewed