Question
I need help with the last two parts of the project A new trash company hired you to make a scale system to weight the
I need help with the last two parts of the project
A new trash company hired you to make a scale system to weight the truck.
In Java, create two classs one named roll off and one named frontend. Hard code 3 truck numbers and 3 weights listed below for each. Enable it to be able to take user input, the input will be the truck number and the weight to subtracted from the truck. There also needs to be the ability to add new trucks and weight as the company grows, and it also needs to be protected.
Front End
Truck number = 10401, Truck weight = 15500
Truck Number = 10402, Truck Weight = 33000,
Truck Number = 10403, Truck weight = 25500
Roll Off
Truck 1 number = 10101,Weight = 10500
Truck 2 number = 10202, Weight = 12500
Truck 3 number = 10302, Weight = 15531
import java.util.Scanner; /* * Truck 1 weight = 15500, Truck number = 10401 * Truck 2 weight = 33000, Truck Number = 10402 * Truck 3 weight = 25500, Truck Number = 10403 */ public class FrontEnd { private Location location; private int truck1 = 10401; private int truck2 = 10402; private int truck3 = 10403; private float Truck1Weight = 15500; private float Truck2Weight = 33000; private float Truck3Weight = 25500; //legal limit private int limit = 18000; public void FrontEndTruckWeight() { Scanner sc = new Scanner(System.in); System.out.print("Enter Truck Number: "); int truck = sc.nextInt(); System.out.print("Enter Weight: "); float weight = sc.nextInt(); if(truck == truck1){ System.out.println("Your weight is: " + Tonnage(Truck1Weight, weight)); } else if(truck == truck2){ System.out.println("Your weight is: " + Tonnage(Truck2Weight, weight)); } else if(truck == truck3){ System.out.println("Your weight is: " + Tonnage(Truck3Weight, weight)); } else{ System.out.println("Not a valid truck number..."); } } private float Tonnage(float truck, float weight) { float tons = (weight - truck) / 2000; return tons; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started