Questions1 write a programme that computes the rental

Assignment Help JAVA Programming
Reference no: EM13373185

Questions:

1. Write a programme that computes the rental charge given the type of moped, when it is rented (weekday or weekend), and the number of hours rented.

The rental charges are as follows:

(a) Type of moped '50cc Mopette': Weekly rental is $15 for the ?rst 3 hours and $2:50 per hour after the ?rst 3 hours. Weekend rental is $30 for the ?rst 3 hours and $7:50 per hour after the ?rst 3 hours.

(b) Type of moped '250cc Mohawk': Weekly rental is $25 for the ?rst 3 hours and $3:50 per hour after the ?rst 3 hours. Weekend rental is $35 for the ?rst 3 hours and $8:50 per hour after the ?rst 3 hours.

Create a class called Moped with appropriate data members (attributes or properties) and methods. Be sure to have a constructor that can accept the size (50cc or 250cc) to determine the type of moped and another one for the different default rental amounts. The class design should include:

(a) Data Members (attributes): size, dayOfWeek, hours, name, three- HourPrice, hourlyPrice, totalCost.

(b) Constructors: Moped() (default values will be for 50cc) andMoped(int size, String day, int hours).

(c) Accessor (Get) Methods: getSize(), getDayOfWeek(), getHours(), getName(), getThreeHourPrice(), getHourlyPrice(), getTotalCost().

(d) Mutator (Set) Methods: setSize(int s), setDayOfWeek(String d), setHours(int h).

(e) Computation Methods: computeTotalCost, mopedName, isWeekend (you can also add some helper methods if you need).

The following UML diagram might be of assistance:

2. Write a driver class called MopedRental. This class should perform the following: asks the user to enter the size of the moped, the day of the week and the number of hours rented, creates the Moped object, based on the size, and displays the input data, type of moped and the total cost of the moped rental. Use the appropriate format for the output values.

3. Scoring in a single game of tennis starts with love-all, then scores of 15, 30, and 40. A player wins when he or she is two points ahead of their opponent and has a score of over 40, where the terms advantage server, deuce (tied score), and advantage receiver are used when the score is 40-all or higher.

Prepare a class called TennisGame that can be used to encapsulate the score in a single game of tennis. Then write a driver program called TennisSet, that plays a set of ?ve games of tennis between two players A and B (randomly choosing the winner of each point), ideally alternating the server for each game, and outputting a commentary of the progress and result of each game.

Reference no: EM13373185

Questions Cloud

Case studypart 1axolotl corporation a small company from : case studypart 1axolotl corporation a small company from eastern washington is currently producing avionic parts and
Need help figuring out the proper steps on how to solvewhat : need help figuring out the proper steps on how to solvewhat volume of 1.25m hcl in liters is needed to react completely
Create an application for an animal-fur trimming service : create an application for an animal-fur trimming service. the business is open 15 weeks of the year from april through
Design constraintsyour program should confirm to the : design constraintsyour program should confirm to the following constraints.nbsp it shouldinclude at least one example
Questions1 write a programme that computes the rental : questions1. write a programme that computes the rental charge given the type of moped when it is rented weekday or
Question 1 the text file xydata5 contains the variables x1 : question 1. the text file xydata5 contains the variables x1 y1 x2 and y2. for this question hand in your r commands
One of the most important skills to learn in managerial : one of the most important skills to learn in managerial economics is the ability to identify a good business.1- discuss
Advanced management accountingplease include thorough : advanced management accountingplease include thorough explanation and thorough calculations for each answer
You are working as student assistance for an engineering : you are working as student assistance for an engineering firm and are paid by the hour. every two weeks you turn in a

Reviews

Write a Review

JAVA Programming Questions & Answers

  Writing a program to have it generate random words

How would I go about writing a program to have it generate random words with a letter missing for a child to guess? Maybe it would have three letters, then four, next five, and so on until maybe 10 letters. Please keep in mind that I'd like it to wor..

  Application that reads the lengths of sides of a triangle

Write a java application that reads the lengths of the sides of a triangle from the user.

  The desired functionality is for your programs to input

the desired functionality is for your programs to input pairs of natural numbers as theyre entered by the user until

  Write a complete java program assuming that the variables gp

Write a complete java program Assuming that the variables gpa, deanList and studentName have been declared, you should read in the studentName and gpa from keyboard. Write an if statement that adds 1 to deansList and prints studentName to the standar..

  The class overloaded constructor receives a 2-dim int array

The class overloaded constructor receives a 2-dim int array as a parameter and assigns its values to a private 2-dim int array. Have another method that prints the whole 2-dim table.

  Point of sale terminal

a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can use the system to manage sales items in the store, customer details and of c..

  Ask the user to enter a positive non-zero integer value.

Write a program which aske the user to Enter a positve non-zero integer value. if the value enterd zero or negative print as error message and end the program; otherwise, use the integer to call a method displayPattern(n) which must display the follo..

  Write ijvm program to multiply two hexadecimal numbers

Write the IJVM program that multiplies two (hexadecimal) numbers. The user inputs the hex numbers and the result is printed out. The program then accepts another pair of numbers.

  Template files contain the message text

Template files contain the message text, together with variable fields(such as Dear [Title] [Last Name ] ...). A database (stored as a text file) contains the field values for each recipient. Use HTML as the output file format. Then design and implem..

  Eax contains the given contents before the instruction

For each add instruction in this problem, assume that EAX contains the given contents before the instruction is executed, and give the contents of EAX as well as the values of the CF, OF, SF, and ZF flags after the instruction is executed:

  Programming exercises

Programming Exercises 1. Write an application named BadSubscriptCaught in which you declare an array of 10 first names. Write a try block in which you prompt the user for an integer and display the name in the requested position.

  Using netbeans, use repetition to display a table of values

Using Netbeans, use repetition to display a table of values showing x, the square of x and the cube of x. X is to go up to 5.

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