Computers and Technology
Computers and Technology, 04.11.2021 14:00, Kana81

This Question is an actual FRQ from a past exam. A. Make all the necessary modifications
B. Submit the .java file

//This question involves analyzing simulated flights a traveler might take to determine the number of points the traveler can earn.
//Travelers earn points based on the number of miles traveled.
//The points can be used for special services.
//The number of miles traveled on each simulated flight is obtained by calling the milesTraveled method in the following AirTravel class.
//You will write the methods in the class including the main method. (This part would NOT appear on the AP exam)

public class AirTravel
{

// Returns the number of miles traveled in a simulated flight.
// Assume the value returned is greater than 0.

public static int milesTraveled()
{ /* implementation not shown */ }

/** Returns the total number of points earned for numFlights flights,
* as described in part (A)
* Precondition: 0 < numFlights
*/

public static int totalPointsEarned(int numFlights)
{ /* to be implemented in part (A) */ }

// There may be variables and methods that are not shown.
}

// TASK

// (A) Write the totalPointsEarned method, which returns the total number of points earned for numFlights simulated flights.

// Miles for each simulated flight are retrieved by calling the milesTraveled method,
// which returns the number of miles traveled in one flight.
// After the miles for all of the flights have been accumulated, points are awarded
// according to the following rules:

// For the first 1,000 miles traveled, 1 point is earned per mile.
// For additional miles traveled up to 10,000 miles, 2 points are earned per mile.
// For additional miles traveled beyond 10,000 miles, 5 points are earned per mile.

// For example, for a total of 12,000 miles, a traveler earns 1,000 points for the
// first 1,000 miles, plus 2 × 9,000 points for miles 1,001 to 10,000, plus
// 5 × 2,000 points for miles 10,001 to 12,000.
// Therefore, the total number of points earned is 1,000+(2×9,000)+(5×2,000)=29,000
//

// Complete method totalPointsEarned.

// Returns the total number of points earned for numFlights flights, as described in part (A)

// Precondition: 0 < numFlights (a precondition is a condition that must be true for your method code to work)

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, dramaqueenactr2040
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
image
Computers and Technology, 22.06.2019 15:10, reycaden
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
image
Computers and Technology, 23.06.2019 15:10, cathyjuan
What role did women fill during world war ii?
Answers: 1
image
Computers and Technology, 23.06.2019 22:30, meijorjay94p2u2zy
Apart from confidential information, what other information does nda to outline? ndas not only outline confidential information, but they also enable you to outline .
Answers: 1
Do you know the correct answer?
This Question is an actual FRQ from a past exam. A. Make all the necessary modifications
B....

Questions in other subjects: