Question

In: Computer Science

Programming Language = JAVA I wanna make menu -driven using these items. 1. one 2. two...

Programming Language = JAVA

I wanna make menu -driven using these items.

1. one
2. two
3. three
4. four
5. exit

This program will read a txt data and will display them in console.

text.txt

98765432,C,John,Smith,23 Church Ave,Central,2123,8,Valid
98765431,C,Joe,Smith,55 Church Street,Genzi,2323,0,Valid
98765430,C,Bob,Smith,23 Gong Road,Warambull,2443,0,Valid
98765429,C,Mike,Smith,42 Mike Street,Waterloo,2222,0,Valid
98765428,C,Juan,Smith,522 Banana steet,Bank,2423,2,Valid
98765427,C,Mike,Jones,232 Milemium lane,Sumrise,2753,13,Suspended
98765426,C,David,Smith,551 Russian Mountain ave,Kogara,2121,0,Valid
98765425,C,Sarah,Smith,123 Straight Street,Cronulla,2232,3,Valid
98765424,C,James,Smith,23 lane,Coroloa,2345,7,Valid
98765423,C,Mike,White,4 Loman Lane,Orange,2665,14,Suspended
98765422,C,Brendon,Fei,55 bal bay,sate,2757,0,Valid
98765421,C,Jian,Zhang,62 london Street,mango,2553,0,Valid
98765420,C,Choi,Saraha,11 hamberguer Street,kefece,2753,0,Valid
98765432,C,Godam,City,32 Kent Street,Maccus,2876,0,Valid

when user press 1, this program will display a report about this txt file.

a report will include number(98765420), family name, first name, suburb, point(0,3,2,,,), status(valid).

please display well-organized format, and also please provide special option which displays this report in the decending order of point(0,3,2).

Solutions

Expert Solution

/************************Person.java*******************/


/**
* The Class Person.
*/
public class Person implements Comparable<Person> {

   /** The number. */
   private int number;

   /** The family name. */
   private String familyName;

   /** The first name. */
   private String firstName;

   /** The subrub. */
   private String subrub;

   /** The point. */
   private int point;

   /** The status. */
   private String status;

   /**
   * Instantiates a new person.
   *
   * @param number the number
   * @param familyName the family name
   * @param firstName the first name
   * @param subrub the subrub
   * @param point the point
   * @param status the status
   */
   public Person(int number, String familyName, String firstName, String subrub, int point, String status) {
       super();
       this.number = number;
       this.familyName = familyName;
       this.firstName = firstName;
       this.subrub = subrub;
       this.point = point;
       this.status = status;
   }

   /**
   * Gets the number.
   *
   * @return the number
   */
   public int getNumber() {
       return number;
   }

   /**
   * Sets the number.
   *
   * @param number the new number
   */
   public void setNumber(int number) {
       this.number = number;
   }

   /**
   * Gets the family name.
   *
   * @return the family name
   */
   public String getFamilyName() {
       return familyName;
   }

   /**
   * Sets the family name.
   *
   * @param familyName the new family name
   */
   public void setFamilyName(String familyName) {
       this.familyName = familyName;
   }

   /**
   * Gets the first name.
   *
   * @return the first name
   */
   public String getFirstName() {
       return firstName;
   }

   /**
   * Sets the first name.
   *
   * @param firstName the new first name
   */
   public void setFirstName(String firstName) {
       this.firstName = firstName;
   }

   /**
   * Gets the subrub.
   *
   * @return the subrub
   */
   public String getSubrub() {
       return subrub;
   }

   /**
   * Sets the subrub.
   *
   * @param subrub the new subrub
   */
   public void setSubrub(String subrub) {
       this.subrub = subrub;
   }

   /**
   * Gets the point.
   *
   * @return the point
   */
   public int getPoint() {
       return point;
   }

   /**
   * Sets the point.
   *
   * @param point the new point
   */
   public void setPoint(int point) {
       this.point = point;
   }

   /**
   * Gets the status.
   *
   * @return the status
   */
   public String getStatus() {
       return status;
   }

   /**
   * Sets the status.
   *
   * @param status the new status
   */
   public void setStatus(String status) {
       this.status = status;
   }

   /*
   * (non-Javadoc)
   *
   * @see java.lang.Object#toString()
   */
   @Override
   public String toString() {
       return "Person \nNumber=" + number + "\nFamily Name=" + familyName + "\nFirst Name=" + firstName + "\nSubrub="
               + subrub + "\nPoint=" + point + "\nStatus=" + status;
   }

   /*
   * (non-Javadoc)
   *
   * @see java.lang.Comparable#compareTo(java.lang.Object)
   */
   @Override
   public int compareTo(Person arg0) {
       if (this.point < arg0.point) {

           return 1;
       } else if (this.point > arg0.point) {

           return -1;
       } else {
           return 0;
       }
   }

}
/***********************************Assignment.java************************/

1. Display All
2. Sort By Point
3. three
4. four
5. exit
Select one option: 1
Person
Number=98765432
Family Name=JohnSmith
First Name=John
Subrub=Central
Point=2123
Status=Valid

Person
Number=98765431
Family Name=JoeSmith
First Name=Joe
Subrub=Genzi
Point=2323
Status=Valid

Person
Number=98765430
Family Name=BobSmith
First Name=Bob
Subrub=Warambull
Point=2443
Status=Valid

Person
Number=98765429
Family Name=MikeSmith
First Name=Mike
Subrub=Waterloo
Point=2222
Status=Valid

Person
Number=98765428
Family Name=JuanSmith
First Name=Juan
Subrub=Bank
Point=2423
Status=Valid

Person
Number=98765427
Family Name=MikeJones
First Name=Mike
Subrub=Sumrise
Point=2753
Status=Suspended

Person
Number=98765426
Family Name=DavidSmith
First Name=David
Subrub=Kogara
Point=2121
Status=Valid

Person
Number=98765425
Family Name=SarahSmith
First Name=Sarah
Subrub=Cronulla
Point=2232
Status=Valid

Person
Number=98765424
Family Name=JamesSmith
First Name=James
Subrub=Coroloa
Point=2345
Status=Valid

Person
Number=98765423
Family Name=MikeWhite
First Name=Mike
Subrub=Orange
Point=2665
Status=Suspended

Person
Number=98765422
Family Name=BrendonFei
First Name=Brendon
Subrub=sate
Point=2757
Status=Valid

Person
Number=98765421
Family Name=JianZhang
First Name=Jian
Subrub=mango
Point=2553
Status=Valid

Person
Number=98765420
Family Name=ChoiSaraha
First Name=Choi
Subrub=kefece
Point=2753
Status=Valid

Person
Number=98765432
Family Name=GodamCity
First Name=Godam
Subrub=Maccus
Point=2876
Status=Valid

1. Display All
2. Sort By Point
3. three
4. four
5. exit
Select one option: 2
Person
Number=98765432
Family Name=GodamCity
First Name=Godam
Subrub=Maccus
Point=2876
Status=Valid

Person
Number=98765422
Family Name=BrendonFei
First Name=Brendon
Subrub=sate
Point=2757
Status=Valid

Person
Number=98765427
Family Name=MikeJones
First Name=Mike
Subrub=Sumrise
Point=2753
Status=Suspended

Person
Number=98765420
Family Name=ChoiSaraha
First Name=Choi
Subrub=kefece
Point=2753
Status=Valid

Person
Number=98765423
Family Name=MikeWhite
First Name=Mike
Subrub=Orange
Point=2665
Status=Suspended

Person
Number=98765421
Family Name=JianZhang
First Name=Jian
Subrub=mango
Point=2553
Status=Valid

Person
Number=98765430
Family Name=BobSmith
First Name=Bob
Subrub=Warambull
Point=2443
Status=Valid

Person
Number=98765428
Family Name=JuanSmith
First Name=Juan
Subrub=Bank
Point=2423
Status=Valid

Person
Number=98765424
Family Name=JamesSmith
First Name=James
Subrub=Coroloa
Point=2345
Status=Valid

Person
Number=98765431
Family Name=JoeSmith
First Name=Joe
Subrub=Genzi
Point=2323
Status=Valid

Person
Number=98765425
Family Name=SarahSmith
First Name=Sarah
Subrub=Cronulla
Point=2232
Status=Valid

Person
Number=98765429
Family Name=MikeSmith
First Name=Mike
Subrub=Waterloo
Point=2222
Status=Valid

Person
Number=98765432
Family Name=JohnSmith
First Name=John
Subrub=Central
Point=2123
Status=Valid

Person
Number=98765426
Family Name=DavidSmith
First Name=David
Subrub=Kogara
Point=2121
Status=Valid

1. Display All
2. Sort By Point
3. three
4. four
5. exit
Select one option: 5

Please let me know if you have any doubt or modify the answer, Thanks :)


Related Solutions

JAVA PROGRAMMING Hi! I need to create a calculator using do/while loop that calls a menu...
JAVA PROGRAMMING Hi! I need to create a calculator using do/while loop that calls a menu switch where the user choice the calculation type. In the switch each case calls a method to each type of calculation (addition/subtraction/division/multiply/ change set of numbers in the array) those methods sends back the result to be displayed in another method. This application needs to hold the user input's numbers as an array. Thanks for your time. It is a great help!
Choose one of the following cryptography techniques and implement it using (java )programming language. Your program...
Choose one of the following cryptography techniques and implement it using (java )programming language. Your program should provide the user with two options Encryption and Decryption, with a simple UI to get the input from the user, and view the result. You can use any restriction you need for the user input but you need to clarify that and validate the user input base on your restriction. ● Feistel ● Keyword columnar ● Any cryptosystem of your choice (needs to...
Write a menu-driven C++ program with two options: 1) Is it odd or even? 2) End...
Write a menu-driven C++ program with two options: 1) Is it odd or even? 2) End Program.The user can only input a positive integer (0 does not count) and if the input is not a positive integer the program must state "Invalid Input." The program must determine whether the input is even or odd. The program must use functions and can only use the iostream and iomanip libraries. Note: The program must loop until the 2nd menu option is chosen.
Programming Language: JAVA In this assignment you will be sorting an array of numbers using the...
Programming Language: JAVA In this assignment you will be sorting an array of numbers using the bubble sort algorithm. You must be able to sort both integers and doubles, and to do this you must overload a method. Bubble sort work by repeatedly going over the array, and when 2 numbers are found to be out of order, you swap those two numbers. This can be done by looping until there are no more swaps being made, or using a...
CIT 149 JAVA 1 programming question. The Assignment This program will display a menu to the...
CIT 149 JAVA 1 programming question. The Assignment This program will display a menu to the user from which they can choose an option to find the area of a rectangle, the area of a triangle, or to quit. The user will make the selection and will be prompted to enter the height and width, or the base and height, depending upon which selection they made. The program will then calculate the appropriate area and display the results. This program...
Using the Java programming language: Create and implement a class Car that models a car. A...
Using the Java programming language: Create and implement a class Car that models a car. A Car is invented to have a gasoline tank that can hold a constant max of 12.5 gallons, and an odometer that is set to 0 for a new car. All cars have an original fuel economy of 23.4 miles per gallon, but the value is not constant. Provide methods for constructing an instance of a Car (one should be zero parameter, and the other...
Implement Radix Sort using PYTHON programming language. Use one of the two options for the algorithm...
Implement Radix Sort using PYTHON programming language. Use one of the two options for the algorithm to sort the digits: Use Counting Sort or Bucket Sort. • Assume the numbers are maximum 4-digit numbers. • If using Counting Sort, you can see that your digit range is between 0 and 9 ([0…9]). • If using Bucket Sort, you will have ten buckets labeled from 0 to 9. Please add comments and explain every step carefully.
The programming language that is being used here is JAVA, below I have my code that...
The programming language that is being used here is JAVA, below I have my code that is supposed to fulfill the TO-DO's of each segment. This code in particular has not passed 3 specific tests. Below the code, the tests that failed will be written in bold with what was expected and what was outputted. Please correct the mistakes that I seem to be making if you can. Thank you kindly. OverView: For this project, you will develop a game...
JAVA programming language Modify the following code. Make changes so that Movies can be sorted by...
JAVA programming language Modify the following code. Make changes so that Movies can be sorted by title ----------------------------------------------------------------- package Model; import java.time.Duration; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; // TODO - Modify the movie class so that Java knows how to compare two Movies for sorting by title public class Movie extends DataStoreObj { private String title; private String description; private LocalDate releaseDate; private Duration runningTime; private Rating rating; private List<Genre> genres = new ArrayList<>(); private List<Actor> actors = new...
SUMMARY Using Java’s Generics framework, make two classes… one that stores 2 items of any given...
SUMMARY Using Java’s Generics framework, make two classes… one that stores 2 items of any given type (Pair) and one that stores 3 items of any given type (Triple). Then use the triple value class to store the win & loss records of multiple football teams (or any sport) in an array. Next loop through array and calculate the winning percentage of each team and add team name and win % to a pair class, and then add that instance...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT