Determine the type of moped

Assignment Help JAVA Programming
Reference no: EM13114865

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: EM13114865

Questions Cloud

Identify the coefficient of kinetic friction : The pulling force has a magnitude of 81.5 N and is directed at an angle of 30.0° above the horizontal. Identify the coefficient of kinetic friction.
Explain develop a technology plan : Explain Develop a technology plan, a proposal of your technology recommendations, for addressing those problems.
What mass of this substance must evaporate : What mass of this substance must evaporate in order to freeze 170 of water initially at 23? (The heat of fusion of water is 334 the specific heat of water is 4.18 .
What information could insurance agent gleen from such data : Should insurance companies be given access to a prospective client's whole genome sequence? Why or why not? What information could the insurance agent gleen from such data?
Determine the type of moped : 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..
Description of long term debtor : For the year ending June 30, 2008, the New Corporation has current assets of $275,000 and total assets of $900,000. It also has current liabilities of $100,000, equity of $200,000, and retained earnings of $300,000.
Illustrate what was the angular acceleration of the grinding : Illustrate what was the angular acceleration of the grinding wheel as it slowed down? Through what total angle did the wheel turn between t = 0 and the time it stopped?
Real estate profit for desired return : Kevin wants a return of 50% from his one-year investment in real estate. He believes that he can sell the property at the end of the year for $250,000 and that the property will provide him with income of $50,000.
Find better relative to class using standard deviation : Class where the mean is 85 and the standard deviation is 4.59, who did better relative to their class? Note both did better than the class mean. How do you answer this question?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Socket programming in java: tcp

In this project we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous service requests in parallel.

  Create a project in eclipse

Create a new project

  Program to find maximum-minimum of sequence of values

Common task which should be done in loop is to find maximum and minimum of sequence of values. File Temps.java contains program which reads in sequence of hourly temperature readings over 24- hour period.

  A remote web-based file storage application

Develop a web-based application. The server-side part of the application must be developed using Java Servlets (possibly including JSP). The development of the client (browser) side will typically be a combination of HTML and Javascript.

  Write java program to find calories-conditional operator

Write down the answer for this program? Write down Java program (use Conditional (? Operator) which suggests number of calories a person must eat each day.

  Java program for real estate agent

Write down java program for real estate agent. Program must perform the following tasks: ask users for average house price for the each of past 5 years for single family residence of 1500 square feet.

  Java application to permit user to enter ten numbers

Write down Java application which permits a user to enter 10 numbers (double precision) into the array and then sorts and displays numbers from lowest to highest.

  Compilation and Execution - JAVA problem

Style marks are based on how your submitted code looks. Remember that good code is easily readable (and understandable) by someone who did not write it. For assignments, you should also include your name, student number, what course this is, what ass..

  Java program for line item application

This exercise explains you the process of testing and enhancing Line Item application. Open LineItemApp, Validator, Product, LineItem, and ProductDB classes that are in the c:java1.6ch06LineItem directory and review this code.

  Implementation of memory management

Implementation of memory management

  Java program to compare two variables if they are equal

Write down program which will ask user to initialize two character arrays, program must compare two variables if they are equal.

  Record managing system application

Build a student record managing system application

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