Create a new class within the project

Assignment Help Programming Languages
Reference no: EM131204631

Assignment

This assignment will be marked out of 100 and carries 30% of the overall module weighting. Your .java files and report for this part must be uploaded to WebLearn and submitted by 3pm on Wednesday 27th April 2016. The assignment must be carried out individually so you must not obtain help from anyone other than the module teaching staff. You must not copy code from any source apart from the module core text and the module materials in WebLearn. Collusion, plagiarism (unreferenced copying) and other forms of cheating constitute Academic Misconduct, which can lead to failure of the module and suspension from the University.

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).

Deliverables

Create a new class within the project called CarCompany. When you are ready to submit your solution, upload your CarCompany.java file, together with the Car.java, CarToBuy.java and CarToRent.java files from the first part of the coursework (not any other files from the project) to WebLearn, together with your report in Microsoft Word format and, when you are absolutely sure that you have uploaded the correct files, press the submit button.

Program

An example GUI is shown below:

710_Java.png

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 to buy 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 is added 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, which is 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:

1740_Java1.jpg

7) Clear

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

Marks will be awarded as follows:

1) GUI
2) The actionPerformed method
3) The main method
4) Functionality of buttons
5) Reading input
6) Use of try/catch, checking input and displaying appropriate message dialogs
7) Program style (see https://www.bluej.org/objects-first/styleguide.html)

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 to Figure 1 from the command prompt learning aid.

2) Test the following:

adding a car to buy adding a car to rent selling a car renting a car returning a car displaying 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.

Verified Expert

The task of the assignment is to develop a java program. The assignment requires to create 3 Java files namely Car.Java, CarToBuy, CarToRent.java. The application developed is the BlueJ IDE. The assignment is provided with the documentation. The documentation contains the class diagram. The class diagram contains the attributes and methods of each class. The documentation is provided with the description of each methods of the class. A testing is done on those class by inspecting the attributes of the class. At the end of the assignment some of the error detection correction done while developing the program is attached in addition to the conclusion of the documentation

Reference no: EM131204631

Questions Cloud

What factors might influence your decision : Would you look for another place to shop or continue to shop there but voice your dissatisfaction? What factors might influence your decision?
Describe the differences between od practices domestically : Describe an organizational change initiative that you have experienced or researched (choose one). In what specific instances would that change initiative be most applicable; also, offer one strategy that would improve the usefulness of that chang..
A galvanometer with a full scale current : The multiplying power (the ratio of measured current to galvanometer current) of 100 Ω shunt with this galvanometer is:
Explain how information systems influence businesses : Explain how information systems influence businesses to be more competitive, efficient, and profitable. Provide at least one example for each factor.
Create a new class within the project : CS4001 Programming - 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.
Innovation and organizational processes : Examine potential changes in IT related to innovation and organizational processes. List and describe internal (online) information security risks and mitigation tactics and how they will effect decision-making strategies.
What kinds of changes might influence student performance : Thinking globally . What factors other than spending per student might influence the comparative performance of students across countries reported in this chapter? What kinds of changes might influence student performance?
What are the implications of this for future research : Are there any important contradictions, arguments, disagreements, or divergences within this set of readings that point to potential areas for future research? How would you follow up to extend or explore these gaps?
Purpose-function of controlling in organizations : Research and describe how the scholarly literature describes the purpose/function of controlling in organizations

Reviews

inf1204631

4/21/2018 4:58:40 AM

Thanks experts. I got every file as required for this assignment to complete. And most important part to tell me the process of running the software. I am new to this so I was not very much sure how to handle it. But you all did for me. thanks a lot. I have got the correct output

inf1204631

1/11/2018 4:27:36 AM

The java files are done using BlueJ software. Do you need me to send files? I don't have any codes for these files. Are your experts able to do the class files? Thanks for the reply I have sent an attachment to of exactly what's required. so everything should be clear now? nothing else needed from my side.

Write a Review

Programming Languages Questions & Answers

  Implement a function for computing the achromatic phong

In this question you need to implement a function for computing the achromatic Phong illumination at a surface point.

  Create program to randomly access data on stocks

A small mutual company wishes you to create program to randomly access data on stocks it holds. Presently, data are stored in a text file, each line of which contains following: a stock code.

  On a 3 x 4 chessboard there are 3 black knights (b b b)

On a 3 x 4 chessboard there are 3 black knights (B B B) and 3 white knights (W W W). Exchange knights in the minimum number of turns (hint: use graph representation).

  Benefits of programming with objects and classes

How is it different from programming with functions alone? Write down benefits of programming with objects and classes in Web applications?

  Explain multiprogrammed system available in user mode

CPU voltage and frequency or put it to sleep altogether. In a multiprogrammed system should this functionality be available in user mode or only accessible via system call. why or why not?

  Program in visual basic to calculate area of triangle

Write a program in visual basic to calculate area of a triangle.

  Write a pseudo code for efficient multiplication

A sparse matrix is a matrix populated primarily with zeros. Classical matrix multiplication is too inefficient for multiplying sparse matrices. Write a pseudo code for efficient multiplication of two sparse matrices, i-by-j matrix A and j-by-k m..

  Describe the design and application of arrays

Describe the design and application of arrays and how the array simplifies program development. Support your answer with hypothetical real-world example.

  Design pseudocode to enter names of two primary colors

Design a pseudocode program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than "red", "blue", or "yellow".

  Write one instruction to reverse the lsb

write ONE instruction to reverse the LSB of the 2nd and 3rd elements of arr - Write code to determine if a data value is a power of 2,

  A class method to initialize class data members.

Sales class data members for a char letter input from the console, a double to hold each individual sale as it is entered and a double for each of the individual salesperson's total commission.

  Draw a erd model a manufacturing company

Draw a ERD model A manufacturing company has several assembly plants in different cities. Each plant produces one product which requires certain parts in its assembly.

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