Write the code for the instantiable class bus

Assignment Help Programming Languages
Reference no: EM13330937

(1a.) Write the code for the instantiable class Bus, which represents a bus that moves passengers around in a simulated city. Bus objects have a ticket price, a maximum capacity of passengers, and a current number of passengers. Implement at least one constructor and three additional methods: one adds passengers without exceeding the capacity, another removes passengers without removing more than are currently riding, and the last method determines the income received for a particular bus based on the number of riders on the bus and the ticket price. No other methods are required. DO NOT USE InputBox or OutputBox objects -- this class is to be considered to be a "helper" class to other classes. If something isn't specified, do something reasonable and comment your assumptions.

(1b.) Write a code fragment that creates two buses, one having a maximum capacity of 40 riders and a ticket price of $0.50, and the other having a maximum capacity of 15 and costing $0.75. Attempt to add 11 passengers to one bus and 22 to the other. Print out the income received for both of these buses. You may assume that an OutputBox object named out exists.

Reference no: EM13330937

Questions Cloud

Explain how many pounds of water vapor are in the air : A room contains 12,000 ft.³ of air at 75°F and 29.7 inches Hg Absolute. The air has a dew point of 60°F. How many pounds of water vapor are in the air
The form and/or function of black families : According to Taylor, which set of theories (and research)--deficit theories or structural perspectives--best account for modern changes in Black families. Why? Provide at least two examples of how economic changes over the past 50 years have shap..
What is the shear deformation : A shear force of 4 x105 N is applied to an aluminum bar of length L = 28 cm, width w = 5 cm, and height h = 1.2 cm, What is the shear deformation
Explain the dew point of a mixture of air and water vapor : What is the dew point of a mixture of air and water vapor at 60°C and 1 atm in which the mole fraction of the water is 12%. The total pressure on the mixture is constant.
Write the code for the instantiable class bus : Write the code for the instantiable class Bus, which represents a bus that moves passengers around in a simulated city. Bus objects have a ticket price, a maximum capacity of passengers, and a current number of passengers.
Describe the distinct differences between lineages : 1.Describe the distinct differences between lineages, clans, moieties, and phratries.
Explain cancerous tumors involve irradiation : Radiation therapy. An effective treatment for some can cancerous tumors involve irradiation with fast neutrons. The neutrons from one treatment source have an average velocity of 3.2 X10-7 m/s.
Estimate the total energy of the system : A block of mass 0.25 kg connected to a spring with spring constant 34 N/m is oscillating on a frictionless horizontal surface. What is the total energy of the system
Differentiate between restorative justice and retributive : Question 1 -Differentiate between restorative justice and retributive justice. Provide examples. Which does the justice system use today?

Reviews

Write a Review

Programming Languages Questions & Answers

  Program to accept inputs from user beginning temperature

Physicists tell us that lowest possible temperature is absolute zero. Absolute zero is -459.69 degrees Fahrenheit. Accept inputs from user: a beginning temperature, ending temperature, and increment value (all Fahrenheit).

  Creating a security policy by gathering information

Suppose mantle of a security consultant. You are asked to visit a client and gather information to develop a security policy for them.

  Create form to accept an arrival and departure date

Create a form that accepts an arrival and departure date for a reservation from the user and then calculates the number of nights and the total price for the reservation.

  Program where the computer plays against a human opponent

Write a function playExpert(marbles) that given a number of marbles returns the number of marbles that the computer will take following the expert mode rules.

  Write a program to solve to find loan on tv

Write a program to solve follwoing problem: A TV set is bought with loan of $563 to be paid off with 5 monthly payments of $116. Interest rate is 1 percent per month.

  Program calculate average number of days employee are absent

Write a program that calculates the average number of days a company's employees are absent. The program should have the following functions: a function called main that asks the user for the number of employees.

  Create a program to compute car-s miles-per-gallon

Create a program which ask's the user for number of miles driven and gallons of gas used. It must compute the car's miles-per-gallon and show the result on the screen.

  Program to overload the addition assignment operator

Overload the addition assignment operator (+=), the subtraction assignment operator (-=), and the multiplication assignment operator (*=).

  Travelling salesman problem

Travelling Salesman Problem on the L1-metric plane.

  Create prototype of function which returns integer value

Develop the C++ function which needs one integer parameter and returns the integer value. Function will double the value passed to it and return doubled value.

  Write method to accept stack containing some elements

Write a method that accepts a stack containing some elements from the file "Q1.txt" and returns a new stack containing the same elements and in the same order as the original stack.

  Writing class containing two instance variables

Write class named ParkingMeter containing: two instance variables named timeLeft and maxTime of type int. Value of timeLeft must be initialized to 0.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd