CS142 Coding Exercise 4 Purpose: The purpose of this coding exercise is for you to gain experience using the switch cons
Posted: Sat Jul 09, 2022 11:49 am
CS142 Coding Exercise 4
Purpose: The purpose of this coding exercise isfor you to gain experience using the switchconstruct in Java.
Company 1 will pay the trucker $PAY totransport the cargo DISTANCE.
Company 2 will pay the trucker $PAY totransport the cargo DISTANCE.
Company 3 will pay the trucker $PAY totransport the cargo DISTANCE.
The trucker will get the most moneyfrom Company X.
Of course, here PAY should getreplaced with the actual pay, DISTANCE with the actual distance,and X with the appropriate company number.
Some Test Cases: To help you with your coding,here are some sample outputs from public static doubletruckerPay(int shipper, double miles).
Purpose: The purpose of this coding exercise isfor you to gain experience using the switchconstruct in Java.
Company 1 will pay the trucker $PAY totransport the cargo DISTANCE.
Company 2 will pay the trucker $PAY totransport the cargo DISTANCE.
Company 3 will pay the trucker $PAY totransport the cargo DISTANCE.
The trucker will get the most moneyfrom Company X.
Of course, here PAY should getreplaced with the actual pay, DISTANCE with the actual distance,and X with the appropriate company number.
Some Test Cases: To help you with your coding,here are some sample outputs from public static doubletruckerPay(int shipper, double miles).