subject
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)

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 06:00, ashleyd198308
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, carolelai08
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
image
Computers and Technology, 24.06.2019 17:40, HealTheWorld
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately
Answers: 2
image
Computers and Technology, 25.06.2019 08:10, pinkpearl2022
Java and c++ are examples of languagehigh-level languagesmachine languagecompiler languages
Answers: 1
You know the right answer?
This Question is an actual FRQ from a past exam. A. Make all the necessary modifications
B....

Questions in other subjects:

Konu
Mathematics, 04.02.2021 03:20
Konu
Mathematics, 04.02.2021 03:20
Konu
Mathematics, 04.02.2021 03:20
Konu
Mathematics, 04.02.2021 03:20