NEW Order Assignment Online and Get upto 100% OFF !!! View all Offers

NEW Order Assignment Online and Get Upto 100% OFF !!! View all Offers

Assignment of the Week – Java Programming

java-script

Java is omnipresent in the IT world, and if you know Java and various IDEs like NetBeans, Eclipse, etc., you are up for a lot of opportunities. The reason for this is that Java is constantly upgraded and is open source. But this wide use of java can pose various difficulties for students who are studying it, because the competition is tough. To help students develop the coding skills required to survive in the brutal industry, difficult java coding exercises are assigned to students.

But, students find it hard to take out the time needed for such assignments. They have to juggle between classes, part-time jobs, and almost always have multiple assignments in hand. Sometimes, they start working on their assignments but fail to complete them on time. Worst of all, codes get stuck and due to the stringent timelines, students are not able to devote sufficient time to debug them. In such cases, they reach out to Java assignment experts, who can help them meet deadlines and submit their assignments on time.

Expert Help from My Assignment Services

Anna, a computer science student contacted us last week for Java assignment help.  Code specifications were provided to her for writing a Java Console Program. The assignment needed her to create a UML diagram and design a class CarPark. Detailed specifications were provided to her and she had started coding on time. But she was not able to run her code. She was getting a number of errors and was stuck on how to fix it. The assignment deadline was just 15 hours away when she contacted My Assignment Services. Our experts were excited at the challenge of writing as well as debugging code in such a short time. They completed the assignment well before the deadline. Anna tested the code herself and was very happy to receive optimised bug-free code. She won an A+.

Anna was so happy with our service that she referred her friends as well. She ordered another assignment from us and availed the referral discount that she had won.

Assignment Question

We are sharing the assignment question, along with the flow chart and the screenshots from the output screens to show you how adept our experts are at Java coding assignments.

Objectives

This assessment item relates to the course learning outcomes as in the Course Profile.

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.

What to submit for this assignment

The Java source code:

  • CarPark.java

A report including a flow chart (UML activity diagram) to depict your validation loop for reading the

hours, how long it took to create, any problems encountered and screen shots of the output produced.

(Use Alt-PrtScrn to capture just the console window and you can paste it into your Word document)

You should test every possibility in the program.

  • ReportAss1.docx

You will submit your files by the due date using the “Assignment 1” link on the Moodle course

website in the Assessment Block or in the relevant week.

Assignment specification

The Rocky car park management has asked you to write a program to help employees determine the

fees for cars using their car park and to also produce some statistics.

You are to write a Java Console Application (CarPark.java) which will allow employees to enter the

details of N cars’ licence plate and the number of hours spent at the Rocky car park. 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 car the program will prompt for and accept the licence plate number of the car and the length of

stay at the car park (in whole hours), it will then display the total cost of parking (see sample output

below for formatting details).

The pricing structure for parking is (maximum twelve hours):

  • The first hour will cost $7.50.
  • The next three hours will cost $4.50 per hour.
  • The next four hours will cost $3.50 per hour.
  • The remaining hours will cost $2.50 per hour.

When all cars’ licence plate numbers and hours stayed have been entered you need to report the

maximum and minimum stay (in hours) and the relevant licence plate numbers, the average stay and

the total parking fees which have been collected.

The required Java Console Application should allow the user to:

  1. For each of the N cars: enter the Licence plate number, and then enter the Length of stay in

whole hours. The program will output the fee for the car’s stay. All dollar values will be

formatted to two decimal places (see implementation below with help for doing this).

  1. You must ensure the licence plate is not blank so you must implement a validation loop so a valid

licence plate number is entered. The number of hours must be between 1 and 12 inclusive and you

will also need to implement a validation loop so valid hours are entered.

The program will number each car in the input prompt.

  1. When N cars have been entered, you will output a heading for the statistics “Statistical

information for the Rocky car park”, the minimum and maximum stays (in hours) and the licence

plate number of the cars with these minimums and maximums, and then what the average stay is

in hours (formatted to two decimal places) (see sample output below). Note: if more than one car

has an equal maximum or minimum stay you just need to only output one of the car’s licence

plate number .

  1. Display a welcome message at the beginning “Welcome to the Rocky car park system” and an

end message e.g. “Thank you for using the Rocky car park system” and the final line

“Program written by <your student ID>” (see sample output below).

The numeric literal values N and parking rates must be represented as constants.

Implementation

A large number of 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 CarPark class which will contain just the main method, COMPILE! (Fix any

errors and repeat)

Implement the welcome message, COMPILE and RUN!

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 loop N Times, COMPILE! (use N = 3 for development)

Declare variables to hold the licence plate number of the car and it’s length of stay (String and int),

COMPILE!

Within the loop: prompt and read the car’s licence plate, COMPILE and RUN!

Add the prompt and read for the length of stay, COMPILE and RUN!

Calculate the parking fee 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”, fee);

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

Use if statements to determine if the stay is maximum or minimum, (you will have to think about

this). Output the minimum and maximums after the loop for testing, 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 hours 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 stays and the corresponding licence plate numbers and the total amount of

parking fees collected.

Calculate the average stay.

Output the statistics as indicated in the screen shot below.

Finally print the end message.

Your program should be well laid out, commented and uses appropriate and consistent names (camel

notation) for all variables and objects.

For this assignment you will not worry about checking data types.

Refer to a Java reference textbook and the course and lecture material for further information about the Java programming topics required to complete this assignment.

Assignment Solution

Rocky’s Car Parking System

Flow chart for Car Parking System:

 fl

Screen Shots of Testing:

Given all correct inputs

1

Prompting the correct inputs of license plate number and Number of hours stay for Car1:

2

Prompting the correct inputs of license plate number and Number of hours stay for Car2:

3

Prompting the correct inputs of license plate number and Number of hours stay for Car3:

4

Checking Maximum and minimum number of hours stay

5

Checking for maximum and minimum number of stay

6

Checking for maximum and minimum number of stay

7

Work around:

It took a week around to develop the coding with the help of topics covered in the first six weeks of course. All the materials has been referred and code is implemented on the course basis.

Problem encountered:

With the Decimal formatting. It has been resolved and string format is used in the code in order to display the real values with two decimal points.

My Assignment Services has a dedicated team of Java programmers who can write optimised code using all IDEs. The benefit of getting Java assignments from our experts is that they write code that is readable and properly commented, so it is easily understandable for both students and professors. They follow proper naming conventions for classes and methods. We know how large classes are an overkill for performance and how unhandled exceptions can cause your code to crash. We test all possible case scenarios, and provide bug-free programs.

We not only provide coding assignments, but if you have to write a research paper on any of your chosen topics, or if you even need help in choosing topics, we are at your service. We provide:

  • Affordable services
  • Before time delivery
  • 100% original and plagiarism-free
  • Partial payments
  • Complimentary Turnitin report
  • 24*7 customer service
  • One-on-one discussions with experts
  • Initial draft
  • Multiple revisions
  • Refer and earn policy

Author: amy

HI! I’m Amy working as an academic writer with My Assignment Services, I hold a relevant 5 years of experience in academic writing. I’m really attached to my work as it allows me to help students in clarifying their concepts and counsel for their assignments. I am an ambitious individual who is looking forward to broadening my career path as an academic writer.

Leave a Reply

Your email address will not be published. Required fields are marked *

11 + 7 =

Live Chat Request Call back! Send an E-Mail Order Now
Place Order