Calculate and store discounted price for all flights

Assignment Help JAVA Programming
Reference no: EM132120813

Assignment task

Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), flight price (double) and discounted flight price (double) for N flights. N should be declared as a constant and it should be equal to the largest digit of your student id number (e.g. if your ID number is S7840213 then N should be equal to 8 and you can declare it as final int N=8;). The flight departure city, flight number, flight distance, flight price and discounted flight price must be stored in an Array/ArrayList (index 0 for flight 1 and index N-1 for flight N). The minimum and maximum flight numbers which can be stored are 1111 and 9999. The minimum and maximum flight prices for each flight which can be stored are $9 and $900. The flight number and price must be entered from the keyboard and a validation for minimum and maximum values must be done.

Your application should display and execute a menu with the following options. A switch statement must be used to execute the following menu options.

1. Read, validate and store data for N flights
2. Calculate and store discounted price for all flights
3. Display all flights
4. Search a flight by number
5. Display all flights with the lowest flight price
6. Sort and display sorted flights
7. Exit from the application

1. Read, validate and store data for N flights

This option reads flight departure city, flight number, flight distance and flight price for N flights from the keyboard and stores them in Array/ArrayList. If the flight number is less than 1111 and greater than 9999 then an appropriate message should be displayed and the user should be asked to enter a new flight number. Similarly if the flight price is less than $9 and greater than $900 then an appropriate message should be displayed and the user should be asked to enter a new price.

2. Calculate and store discounted price for all flights
This option asks the user to enter the discount percentage between 0 and 100 (e.g. 10) and calculates the discounted flight price based on the following formula (discounted flight price = flight price - (flight price * discount percentage)/100) for each flight and then stores discounted price in Array/ArrayList.

3. Display all flights
This option displays the data for all flights (flight departure city, flight number, flight distance, flight price and discounted flight price).

4. Search a flight by number
This option asks user to enter the flight number and searches for it. If flight number is found then it displays an appropriate message with flight details. If flight number is not found then it displays an appropriate message "flight is not found". A built-in search algorithm for searching can be used in this assignment.

5. Display all flights with the lowest flight price
This option finds and displays the flight stored in Array/ArrayList which has the lowest flight price. If there is more than one flight with the lowest flight price then it displays all of them.

6. Sort and display sorted flights
This option sorts (by departure city) all flights stored in Array/ArrayList in descending order and displays all sorted flights (flight departure city, flight number, flight distance, flight price and discounted flight price). You can use any sorting algorithm. A built-in sort algorithm for sorting is not allowed in this assignment.

7. Exit from the application
The application should display an appropriate message with student id and then exit from the application.

The application should work in a loop to enable the user to Read, validate and store data for N flights, Calculate and store discounted price for all flights, Display all flights, Search a flight by number, Display all flights with the lowest flight price, Sort and display sorted flights, and Exit from the application.

Program design
You may use any design that meets the specification. However, a good design will adhere to the following guidelines:
- be logically correct
- be easy to read and maintain
- be well-designed
- use a UML activity diagram
- use appropriate classes, methods and fields

Your design MUST use the classes and methods as listed below. public class Flight
{
//fields
//get and set methods
}
public class FlightTest
{
Method to Read, validate and store data for N flights Method to Calculate and store discounted price for all flights Method to Display all flights
Method to Search a flight by number
Method to Display all flights with the lowest flight price Method to Sort and display sorted flights
Method to Exit from the application public static void main(String[] args)
{
}
}

You may add/use other methods, parameters, fields/variables, constants, etc. which you need to complete the application.

Testing
Testing is important. You should:
- List the different types of test cases.
- Display the results for each test case.

Verified Expert

The given program is a Java Console based program that records the data about flights from different cities, the flight number ,their distance to be travelled ,the cost of the flight and the cost after giving discount . There are validations on the values of cost of the flight and the flight number. The program has facilities such as calculating discounted price of flight, displaying the total flight data , details of a particular flight, sorting the flight data as per departure city and finding the lowest priced flight. The program uses ArrayList to store data and has been successfully executed using Oracle Java 8 and 10 .

Reference no: EM132120813

Questions Cloud

New plant to absorb the backlog of demand that now exists : A producer of pottery is considering the addition of a new plant to absorb the backlog of demand that now exists.
Describe the neurological processes : Please watch the videos listed above. Describe the neurological processes which take place with prosopagnosia. What happens in the brain of an individual.
Pick scenario sales manager might face : Pick a scenario a sales manager might face, and provide some practical ways to balance giving positive and negative feedback.
What design capacity would be needed to achieve : What design capacity would be needed to achieve an actual output of 11 jobs per week? What is its effective capacity?
Calculate and store discounted price for all flights : Calculate and store discounted price for all flights - The application should display an appropriate message with student id and then exit from the application
Who would you go about creating social change : In short paragraphs in one page I want you to answer the questions. Who would you go about creating social change?
Use to compare different suppliers : Create a supplier scorecard that Julie can use to compare different suppliers.
How will what you learned help you improve time management : After reading Ch. 2 of P.O.W.E.R. Learning, answer the following in 50 to 175 words: How can you use what you learned from the chapter and those activities.
Discuss the levels of care in the us healthcare system : Discuss the levels of care in the U.S. healthcare system. There are three delivery mode options.

Reviews

urv2120813

10/31/2018 3:50:46 AM

Dear Team, I am happy to say because of you guys I didn't faced any problem. You are providing a perfect solution to students. You are doing a business that is so helpful for students. You meet all the customer requirements. Because of you, I have got perfect marks. I know you have now paid to the person who made this assignment. I want to say a special thanks to the teacher for my assignment. The received assignment was as per my requirement and the rate of plagiarism was low. So, I would recommend this to my friends. Good job. I liked how the plagiarism was minimum. I only did the minor review. Thanks

urv2120813

10/31/2018 3:42:01 AM

Hello there, Thanks for the reply. Your price is too low I am surprised. And also when you will be able to deliver this? At least if you able to deliver this on Thursday. My mobile number is not linked to my bank account. So I didn't get a net code. Do you guys have any other payment method? I received the assignment. I really delighted that you delivered the assignment on time. Still, this is my first semester. So I will again give you my work. I will check the report and let you know if anything to be changed. Following are the changes which are to be made as they are asked by the teacher. Please go throuh these and find the attached images for your reference. 01. You have to add any comments to the coding. 02. The programme only allows to add 3 flight details. it should be 8. 03. Flight list is to aligned. 04. Discounted price calculation is wrong as I got one answer for all. 05. in the programme display N should be replaced with number 08.

len2120813

9/24/2018 1:58:01 AM

Assessment 2 marking criteria Total Marks – 30 Marks Allocated 1 Design, logic and testing – 14 Code readability – appropriate use of comments, indentation and naming conventions 3 Declaring and using fields/variables and constants 2 Creating/declaring and using objects, methods and classes 3 Overall design and logic (structure, efficiency) 2 Validity of testing as evidenced by submitted test results 2 UML activity diagram for menu option 2 2 2 Compilation and execution - 14 (0 - if application doesn't run) Welcome and exit messages 1 Input data validation and message 1 Read and store all flights 1 Calculate and store discounted price for all flights 2 Display all flights 1 Search for a flight 2 Display all flights with the lowest flight price 2 Sort and display sorted flights 2 Overall program execution (user friendly, input/output and display) 2

len2120813

9/24/2018 1:57:49 AM

You should submit online the following files. • Flight.java (this file contains java code for class Flight) • FlightTest.java (this file contains java code for class FlightTest). • Report.docx (this file contains a brief report that includes student name, student ID, unit name, unit code, UML activity diagram for menu option 2 (Calculate and store discounted price for all flights) and test results (screenshots/test cases with results to show that your application is correctly working)).

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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