Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M93108280
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question? 


Related Questions in Java

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As