Implement a validation loop

Assignment Help Other Subject
Reference no: EM133055962

COIT 20245 Introduction to Programming - Central Queensland University

Assessment - Java Console Program

Details

For this assignment, you are required to develop a Java Console Program to demonstrate you can use Java constructs including input/output via a command line, Java primitive and built-in data types, Java defined objects, selection and looping statements, methods, and various other Java commands. Your program must produce the correct results.

You are only allowed to use techniques which have been covered in the first six weeks of the course, you must use the Scanner object for input and no advanced data structures like arrays will be used. Instructions for this appear in the implementation section of this specification.

Assignment specification

Rocky Personal Trainers program.

The Rocky Personal Trainers company offers personal training for people in the Rockhampton region. Training sessions are either one on one, groups of two (partners) or groups of three to five clients (families). Each session lasts one hour and there is a tiered pricing scheme for the different groups as follows:
One person will be $62.25 per session. Two people is $82.25 per session.
Three to five people is $102.25 per session.

To encourage clients to book more sessions, the management has decided to give a ten percent discount for a booking of ten or more sessions on the total charge.

You are to write a Java Console Application (RockyPersonalTrainers.java) which will allow staff to enter the details of N booking names and the number of training sessions and number of clients for each booking. N should be equal to the highest digit in your student ID, use N=3 if your highest digit is less than three. For each booking the program will prompt for and accept the booking name and the number of training sessions and clients for the booking, it will then display the charge (see sample output below for formatting details).

When all the bookings have been entered you need to report the maximum and minimum number of sessions per booking and the relevant booking name, the average number of sessions per booking and the total charges which have been collected.

The required Java Console Application should allow the user to:

1. For each of the N bookings: enter the booking name, and then enter the number training sessions and the number of clients. The program will output the charge for the booking. All dollar values will be formatted to two decimal places (see implementation below with help for doing this).

2. You must ensure the booking name is not blank so you must implement a validation loop to ensure that a booking name is entered. For this assignment, there is no need to ensure the name is a valid name (e.g. entering 1 for the name would be allowed). The number of training sessions and number of clients must be greater than or equal to one and number of clients not greater than five and you will also need to implement validation loops to ensure that a valid number of training sessions and clients are entered.

The program will number each booking in the input prompt.

3. When N bookings have been entered, you will output a heading for the statistics "Statistical information for Rocky Personal Trainers", the minimum and maximum number of training sessions and the booking names with these minimums and maximums, and then what the average number of training sessions per booking is (formatted to two decimal places) (see sample output below). Note: If more than one booking has an equal maximum or minimum training sessions you just need to only output one of these cases.

4. Display a welcome message at the beginning "Welcome to the Rocky Personal Training Management System" and an end message e.g. "Thank you for using the Rocky Personal Training Management System" and the final line "Program written by <your student ID>" (see sample output below).

The numeric literal values N, number of nights for the different discount levels and booking costs must be represented as constants.

Implementation
Many students have never written a program before so this is a fairly simple assignment which can be written in the main method of your class. Follow the steps outlined here and build your program up in a step-by-step fashion and always compile your program at each stage so you are always working on error-free code.

Start by creating your RockyPersonalTrainers class which will contain just the main method, COMPILE! (Fix any errors and repeat)
Implement the welcome message, COMPILE, RUN and TEST! Declare your Scanner object(s), COMPILE!
Note: In order to combat the problem of the Scanner objects reading both textual and numeric data a good way to counter this is to declare two Scanner objects, one for reading text and another for reading numbers, or you can clear the buffer after the int read using nextLine()

Create a loop to iterate N Times, COMPILE, RUN and TEST! (use N = 3 for development)

Declare variables to hold the booking name and the number of training sessions and clients (String and ints), COMPILE, RUN and TEST!

Within the loop: prompt and read the booking name, COMPILE, RUN and TEST!

Add the prompt and read for the number of training sessions, COMPILE, RUN and TEST! Add the prompt and read for the number of clients, COMPILE, RUN and TEST!
Calculate the booking charges using the pricing structure above, COMPILE, RUN and TEST until this is correct.

Output the description of the transaction (see sample output below) Output all dollar values and average to two decimal places:
USE: System.out.printf("%.2f", charge);

Add the validation loops for reading the data (you can do this last if you like)

Use if statements to determine if the number of training sessions is maximum or minimum, (you will have to think about this). Output the minimum and maximums after the loop, COMPILE and RUN until you have this correct. You may want to set your original max and min variables to very small and very large numbers using Integer.MIN_VALUE and Integer.MAX_VALUE.

You will need to add up the number of training sessions as you go so you can calculate the average. After the loop, you will output the statistics which you have gathered in the loop. You should have the maximum and minimum number of training and the corresponding booking names and the total amount of charges collected.

Calculate the average number of training sessions per booking. Output the statistics as indicated in the screen shot below.
Finally, print the end message.

Your program should be well laid out, commented, and use appropriate and consistent names (camel notation) for all variables and objects. Meaningful comments need to be placed before classes, methods and in the body of the code including variables.
For this assignment, you will not worry about checking data types.

Refer to a Java reference textbook and the unit and lecture material (available on the course WEB site) for further information about the Java programming topics required to complete this assignment. Check the marking guide (last page) to ensure you have completed every task. You need to match the output as shown below including line spacing.

Attachment:- Java Console Program.rar

Reference no: EM133055962

Questions Cloud

Why most groupware is deployed today over web : Explain why it is useful to describe group work in terms of the time/place framework. Explain why most groupware is deployed today over the Web.
What is the annual dividend on the preferred stock : Texas Inc. has 11,000 shares of 8%, $125 par value cumulative preferred stock. What is the annual dividend on the preferred stock
Calculate the terminal value and a discount : Value a company that has current FCFo of $250,000 using a growth rate of 10% for the following 10 years. Assume that the operations of this company will run for
What is the effectiveness of the hedge : How to set the hedging and what is the effectiveness of the hedge? Please demonstrate with calculations.
Implement a validation loop : Demonstrate you can use Java constructs including input/output via a command line, Java primitive and built-in data types, Java defined objects, selection
Balance scorecards impact knowledge creation : Explain how to balance scorecards impact knowledge creation, culture, and strategy. Why are these important concepts to understand within an organization?
Calculate the net present value of the new machine : The net cost of this machine is $250,000 and is expected to have a useful life of 5 years, Calculate the net present value of the new machine
Estimating growth : There are three ways to estimate growth rates for earnings, revenues, and dividends. These include (1) the growth rate of the firm's past (operating) earnings,
Corporate social responsibility section : After reviewing the Corporate Social Responsibility section of Dell's website (www. dell .com/learn/us/en/uscorp 1/cr?-ck=mn) prepare a list of 8 specific polic

Reviews

Write a Review

Other Subject Questions & Answers

  Explain three strategy that will help chloe with her fluency

Research three strategies regarding fluency instruction that will assist Chloe in reaching her goals. In 500-750-words, identify and explain three strategies that will help Chloe with her fluency.

  Calculate correlation between age in months and number of

use the following data set to answer the questions. do this one manually.a. compute the correlation between age in

  What is a fusion center

Fusion Centers are one of the latest efforts to share information and intelligence on a national level. What do you think some of the challenges are

  What is the probability that a randomly chosen light bulb

a manufacturer of compact fluorescent light bulbs advertises that the distribution ofnbsp the lifespans of these light

  Recovered-repressed or false memories-the controversy

One of the concepts touched upon in the text's discussion of memory distortion is the concept of recovered memories.

  Discuss the specific esf

Begin by selecting a contemporary safety issue for today's first responders. Research a specific Emergency Support Function (ESF), and locate an article.

  Comparative analysis of the us healthcare system

The course project is a comparative analysis of the U.S. healthcare system against Koreas healthcare system. The project requirement is a  6-10 pages of double-spaced written material with 1-inch margins on the left, right, top, and bottom and a 1..

  Ask the clinician about food that he should avoid

The vegetarian patient with gout asks the clinician about food that he should avoid. The clinician should advise the patient to avoid

  Analyze the case and explain the facts

Develop and explain your own opinions which should be thought through thoroughly and lead you to make your own conclusion. Merely summarizing cases, methods or frameworks is not sufficient.

  What is the probability of the event that exactly 15 student

POL/SOC 1041-The probability of preferring an essay is 0.65. What is the probability of the event that exactly 15 students vote for the exam?

  Discuss each issue in the context of the scenario facts

How I would Handle Each Issue. First, in this section and for each issue, as a health care provider, how would you handle each of the three issues discussed above and why? Must use the relevant facts in the scenario to support your positions.

  Practice of police profiling of minority motorists

A sample posting might read, "The practice of police profiling of minority motorists is a problem area within criminal justice because it calls into question the principle of equal justice under the law.

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