Write a java console application

Assignment Help JAVA Programming
Reference no: EM132648944

Assignment task

Write a java console application that allows the user to read, validate, store, display, sort and search COVID-19 vaccine data (vaccine name - String type, vaccine id - int type, trial phase -int type and cost - double type) for N vaccines. 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 S382112 then N should be equal to 8 and you can declare it as final int N=8;). If largest digit is less than 3 then N should be equal to 3.

The vaccine name, vaccine id, trial phase and predicted cost must be read from the keyboard and must be stored in an Array or ArrayList (index 0 for vaccine 1 and index N-1 for vaccine N). The minimum and maximum cost which can be stored are $10 and $220. A validation for minimum and maximum values must be done during the reading of vaccine cost.

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 vaccine data for N vaccines
2. Calculate and store the real cost for each vaccine
3. Display all vaccines
4. Display all vaccines in trial phase 3
5. Search a vaccine by id
6. Sort and display vaccines by name
7. Exit from the application

1. Read, validate and store vaccine data for N vaccines
This option reads vaccine name, vaccine id, trial phase and predicted cost for N vaccines from the keyboard and stores them in an Array or ArrayList. If the trial phase is less than 1 and greater than 4 then an appropriate message should be displayed and the user should be asked to enter the trial phase again. Similarly if the predicted cost is less than $10 and greater than $220 then an appropriate message should be displayed and the user should be asked to enter the cost again.

2. Calculate and store the real cost for each vaccine
This option calculates the real cost for each vaccine and then stores the real cost in Array or ArrayList. The formula to calculate the real cost is as follows: real cost = predicted cost - government rebate; where government rebate can be declared as a constant.

3. Display all vaccines
This option displays the vaccine data (vaccine name, vaccine id, trial phase, predicted cost and real cost) for all vaccines.

4. Display all vaccines in trial phase 3
This option displays the vaccine name and vaccine id of all vaccines in trial phase 3. If there is no vaccine in trial phase 3 then it displays an appropriate message.

5. Search a vaccine by id
This option asks user to enter the vaccine id and searches for it. If the id is found then it displays vaccine name, vaccine id, trial phase, predicted cost and real cost. If vaccine is not found then it displays an appropriate message "vaccine with given id is not found". If there is more than one vaccine with the given id then it displays all of them. A built-in search algorithm is not allowed in this assignment.

6. Sort and display vaccines
This option sorts (by name) all vaccines stored in Array or ArrayList in ascending order and displays all sorted vaccines (vaccine name, vaccine id, trial phase, predicted cost and real cost). 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 vaccine data for N vaccines, calculate and store the real cost for each vaccine, display all vaccines, display all vaccines in trial phase 3, search a vaccine by id, sort and display vaccines by name 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 flowchart/UML activity diagram
• use appropriate classes, methods and fields

Your design MUST use the classes as listed below. public class Vaccine
{
//fields to store vaccine name, vaccine id, trial phase, predicted cost and real cost
//relevant methods including set and get methods
}
public class VaccineTest
{
public static void main(String[] args)
{
//menu options using switch statement
//data reading, Vaccine object creation, data storing in array/arrayList, etc.
}
//other static methods
}

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

Testing
Testing is important. You should test your application using many different types of test cases before you submit it for marking.

What to submit
You should submit online the following files.
• Vaccine.java (this file contains java code for class Vaccine)
• Vaccine Test.java (this file contains java code for class VaccineTest).
• 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 real cost for all vaccines) and test results (screenshots for different test cases with results to show that your application is correctly working)).

Attachment:- Java assignment.rar

Reference no: EM132648944

Questions Cloud

PHYS2134 Advanced Medical Imaging Assignment : PHYS2134 Advanced Medical Imaging Assignment Help and Solution, RMIT University - Assessment Writing Service - Describe any image enhancements you do to ease
301235 Applied Cybersecurity Assignment : 301235 Applied Cybersecurity Assignment Help and Solution, Western Sydney University - Assessment Writing Service - analysis and requirements of key research
Write a description of the selected dataset and project : Write a description of the selected dataset and project, and its importance for your chosen company. Information must be appropriately referenced.
BUMAN201A Business Maths and Statistics Assignment : BUMAN201A Business Maths and Statistics Assignment Help and Solution, TAFE NSW - Assessment Writing Service - Calculate the GST exclusive and GST inclusive
Write a java console application : Write a java console application that allows the user to read, validate, store, display, sort and search COVID-19 vaccine data - vaccine name
Prepare a business process report based on a case study : Prepare a business process report based on a case study and should use their own initiative regarding any assumptions and cycle times if needed
Strategy Map and IT Assessment : Strategy Map and IT Assessment - Explain what constitutes value for an organisation and Lead a discussion on the role of EA to support business strategic goals
Reflection of personal learning process : Provide a critical reflection of their personal learning process, as experienced during this unit - A significant aspect of the reflective journal
ISY202 Information Systems Networking Assignment : ISY202 Information Systems Networking Assignment Help and Solution, Australian Institute of Higher Education - Assessment Writing Service

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write all of the strings from the arraylist to that file

Write all of the strings from the ArrayList to that file. Be sure to handle exceptions gracefully -allow them to select where to save the data

  Using the following data definition classpublic class

using the following data definition classpublic class circle private int radiuspublic circleint r radius rpublic int

  Prompt the user for the tax amount

Write detailed pseudo code for a program that is designed to organize a family's tax payments for the past 20 years. The program should accomplish the following tasks: Prompt the user for the tax amount and also the year.

  Build distributed applications using technologies

Build distributed applications using technologies like Unix and Java sockets, SUN RPC, Java RMI, and message-passing tools such as PVM and MPI and

  Develop a menu driven console java program

Review the text p.933for the use of the printf method and using a format string -  You have completed the console program for collecting statistics for the entry of student marks. We are going to extend this application so the student names and ..

  Describes the necessary flow of your program

Create pseudocode that describes the necessary flow of your program with respect to both creating a user account and placing an order.

  Specifications of object instance variables and behaviors

Write simple, accurate object-oriented programs using primitive data types, variables, data structures, and object-oriented principles and implement classes that meet the given specifications of object instance variables and behaviors

  Describing the current field values of the headphones

Create a Java class named HeadPhone to represent a headphone set - getter and setter methods for all data fields.

  Build an android application to execute some of the queries

Build an android application to execute some of the queries -

  Need to add arrays to the program - federal income tax

depends on the choices made by the user. You are not required to check to make sure that the user inputs a valid Roman numeral for this assignment

  Write an expression those results in a string consisting

Write an expression those results in a string consisting of the third through tenth characters of the strings. Make this program using java programming.

  Create test class to constuct and call methods of your class

Create a test class to constuct and call the methods of your class. Describe your class and demonstrate your code functions properly.

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