Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a java program for a trucking company that has 7 trucks in its fleet. Each truck has a number and a maximum weight allowance.

Design a java program for a trucking company that has 7 trucks in its fleet. Each truck has a number and

a maximum weight allowance.

Your program should have two arrays.

1. truckNum array - you should create this array to save truck number.

2. maxWeight array - you should create this array to save maxWeight.

Following should be saved in the truckNum array and maxWeight array

Truck Number Maximum Weight

1 50000

2 25000

3 20000

4 35000

5 40000

6 25000

7 30000

Before the truck can begin its route, it must be weighed to see if it fails within its weight allowance.

So ask the user to enter the truck number and loaded weight. Compare it with the above table that is saved in the arrays, and

display Your truck is ready to roll if the truck weight < the maximum weight for that particular truck

number. Otherwise print the message You have exceeded your weight allowance.

Then ask the user if he wants to continue. If the option is yes, the user can enter the truck number and

the loaded weight

Here is how the console should look when you run your code(it first saves the Truck number and maximum weight in two different arrays. Then it asks the user to Enter the Truck number and truck weight to check if the truck weight is exceeded )

Enter Truck number and maximum weight limit

1 50000

Enter Truck number and maximum weight limit

2 25000

Enter Truck number and maximum weight limit

3 20000

Enter Truck number and maximum weight limit

4 35000

Enter Truck number and maximum weight limit

5 40000

Enter Truck number and maximum weight limit

6 25000

Enter Truck number and maximum weight limit

7 30000

Enter Truck number and truck weight to check

4 40000

You have exceeded the maximum limit

Do you want to continue(yes/no)

yes

Enter Truck number and truck weight

4 35000

Your truck is ready to roll

Do you want to continue(yes/no)

no

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

How does franchising differ from other forms of business ownership?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago