Add a class to the project

Assignment Help JAVA Programming
Reference no: EM131957101

Assignment

Aim

The aim of this assignment is to add a class to the project that you developed for the first part of the coursework to make a graphical user interface (GUI) for a system that stores details of cars in a car company. The class will contain a main method and will be tested using the command prompt. A learning aid about the command prompt is linked from the main index page of the learning materials. You will also need to write a report about your program. You are advised to study the learning aid on reflective practice, which is also linked from the module in WebLearn. Your report should be no more than 1200 words in length (excluding the cover page, table of contents, class diagram, pseudocode and code listing).

Your GUI should contain the same components but you are free to use a different layout if you feel that it improves the aesthetics, ease of use etc. The CarCompany class should store an array list (not an array) of type Car to hold the cars tobuy and the cars to rent.

Text field input methods

For each text field, write a method to read its contents and return the value. For the description, customer name, rental date and return date, the value should simply be returned as a string but, for the other text fields, the input value should be converted into its correct integer data type and then that numerical value should be returned.

There should be text fields for entering:

(1) the price
(2) the year of registration
(3) the mileage
(4) the description
(5) the admin fee
(6) the daily rate
(7) the customer name
(8) the rental date
(9) the return date
(10) the number of days
(11) the car number (its position in an array list of cars)

The input method for the car number is different from the input methods for the other text fields. The method first initialises the car number to -1. If the input from the user via the GUI is valid, the car number will be changed from -1 to a value that corresponds to a car in the array list. The input from the car number text field must therefore be tested using a try/catch statement to ensure that the car number entered is an integer and, if it is, that it is in the correct range. If the value

entered is an integer but is not in the correct range, a suitable error message is displayed using a message dialog box. If the car number entered is not an integer then an alternative error message is displayed using a message dialog box. The method will therefore either return -1 or a value that corresponds to a car in the array list, depending on whether or not there was an error in the input. Any method that gets the car number should check its value and only use it if its value is not equal to -1.

Buttons

The GUI should have the following buttons:

1) Add Car To Buy

The description, price, year and mileage are input via the GUI. When this button is pressed, the methods to get the description, price, year and mileage are called, and these values are used to create a new object of type CarToBuy, which isadded to the array list of cars.

2) Add Car To Rent

The description, admin fee and daily rate are input via the GUI. When this button is pressed, the methods to get the description, admin fee and daily rate are called, and these values are used to create a new object of type CarToRent, whichis added to the array list of cars.

3) Buy Car

The car number and the customer name are input via the GUI. When this button is pressed, the method to get the car number is called and its value is checked. If it is not equal to -1, the method to get the customer name is called, the method to get the car from the array list is called and the car is cast to CarToBuy, then the method from the CarToBuy class to buy the car is called.

4) Rent Car

The car number, customer name, rental date, return date and number of days are input via the GUI. When this button is pressed, the method to get the car number is called and its value is checked. If it is not equal to -1, the methods to get the customer name, rental date, return date and number of days are called, the method to get the car from the array list is called and the car is cast to CarToRent, then the method from the CarToRent class to rent the car is called.

5) Return Car

The car number is input via the GUI. When this button is pressed, the input value of the car number is checked. If a suitable value has been entered, the method to get the car number is called and its value is checked. If it is not equal to -1, the method to get the car from the array list is called and the car is cast to CarToRent, then the method from the CarToRent class to return the car is called.

6) Display All

When this button is pressed, the car number and the information relating to that car is displayed for each car, for example:

7) Clear

When this button is pressed, the text is cleared from all of the eleven text fields.

Report

For the report, marks will be awarded as follows:

A class diagram of just the CarCompany class showing the name of the class, the data types and names of the fields, and the return types and signatures of all of the methods

A short description of each method in the CarCompany class

Pseudocode for the following button-handling methods in the CarCompany class:

1) Add Car To Buy
2) Add Car To Rent
3) Buy Car
4) Rent Car
5) Return Car
6) Display All

You should give evidence through appropriate screenshots of the following testing that you carried out on your program:

1) Test that the program can be compiled and run using the command prompt, including a screenshot similar toFigure 1 from the command prompt learning aid.

2) Test the following:adding a car to buyadding a car to rentselling a carrenting a carreturning a cardisplaying all of the cars

3) Test that appropriate dialog boxes appear when unsuitable values are entered for the car number, (include a screenshot of the dialog box, together with a corresponding screenshot of the GUI, showing the values that were entered).

The report should contain a section on error detection and error correction where you give examples and evidence of three errors encountered in your implementation. The errors (syntax and/or runtime) should be distinctive and not of the same type.

The report should contain a conclusion, where you evaluate your work, reflecting on what you learnt from the assignment. You are advised to study the learning aid on reflective practice, which is linked from the module in WebLearn.

The report should include a title page (including your name and ID number), a table of contents (with page numbers), and a listing of the code (in an appendix). Marks will also be awarded for the quality of writing and the presentation of the report.

Attachment:- Coursework.rar

Verified Expert

The aim of this project is how to create GUI in java. understanding and implementing Panel creation, adding components to panels, reading values from textfields . Also tohow to take action while a particular button is clicked.

Reference no: EM131957101

Questions Cloud

Analyses the company beyond the reported financial figures : FUNDAMENTALS OF VALUE CREATION IN BUSINESS ASSIGNMENT - Analyses the company beyond the reported financial figures
Context of healthcare and future trends : What will family responsibility be in the context of healthcare and future trends?
Ignore inflation in calculations : If you use Excel, explain that process. If you use an app on your phone refer to the first explanation in this question.
What is the earnings per share for company : You find a stock selling for $73.91 that has dividend yield of 3.8 percent. If company has a P/E ratio of 16.9, what is the earnings per share for company?
Add a class to the project : CS4001 Programming - reflecting on what you learnt from the assignment. You are advised to study the learning aid on reflective practice
Relationship between interest rates and bond value : Explain the relationship between interest rates and bond value. What makes interest rates change?
What is the proper cash flow : What is the proper cash flow to use as the initial investment for this project?
Personal finance-future value and present value : You have a nest egg put aside to purchase a home of $7500. How much is it going to be worth when you retire in 25 years?
What is the earnings per share : What is the earnings per share, or EPS, figure? What is the dividends per share figure?

Reviews

Write a Review

JAVA Programming Questions & Answers

  What is object-oriented programming

What is object-oriented programming? What are the differences between a class and an object

  Determine total annual compensation of a salesperson

Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors: A salesperson will earn a fixed salary of $45,000

  Write a java application that uses an interactive gui

In this assignment, you are required to write a Java Application that uses an interactive Graphical User Interface (GUI) based on the JFrame class

  Create a class called studentquizscores

Within DrJava, create a class called StudentQuizScores and do the following using a loop. Your program should display this string using a JOptionPane.

  Discuss and describe if a company believed

Discuss and describe If a company believed that a nation was preparing to devalue its currency

  Which is the best character high value

When updating a master file with data from a transaction file, what should happen for an addition record when a match is found in the master file?

  Write java program- takes all lines input to standard input

Write a short Java program that takes all the lines input to standard input and writes them to standard output in reverse order. That is, each line is output in the correct order, but the ordering of the lines is reversed.

  Create a virtual directory

Create a Web archive file and attach to this assignment. Do not copy (cut and paste) any example code, create your own code and use the examples as a guide.

  Use javascript to write the onmouseenter event handler

Use JavaScript to write the onmouseenter event handler for the mouse enter event of the img tags (similar to the onclick event handler of the img tags in the ImageSwap/SlideShow applications). This handler should change the src attribute of the im..

  Compute the maximum of two numbers

Write a program that that computes the maximum of two numbers. Create a class called MaxProgram - Print the returned maximum number

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  The fileiohelper class provides 2 class methods

1.int FileIOHelper.getNumberofStudents(String fileName): takes a String parameter which is the name of an input file in the format described above, and returns the number of students in the file

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