import java.util.ArrayList;
import java.util.Scanner;
public class PhoneBookEntryTest {
public static void main(String args[]){
ArrayList<PhoneBookEntry>
phonebook = new ArrayList<PhoneBookEntry>();
Scanner sc = new
Scanner(System.in);
System.out.println("\nEnter phone
book details"+
"\n e.g. John 1234");
for(int i=0;i<10;i++){
String str =
sc.nextLine();
PhoneBookEntry
records = new PhoneBookEntry(str.split("
")[0],Integer.parseInt(str.split(" ")[1]));
phonebook.add(records );
}
System.out.println("Records are:
");
for(int
i=0;i<phonebook.size();i++){
PhoneBookEntry
book = phonebook.get(i);
System.out.println("Name: "+book.getName()+" Phone No:
"+book.getPhoneno());
}
}
}

Phone Book ArrayList Write a class named PhoneBookEntry that has fields for a person’s name and...
Write a class named PhoneBookEntry that has fields for a person's name and phone number.The class should have a constructor and appropriate accessor and mutator methods. Thenwrite a program that creates at least five PhoneBookEntry objects and stores them in anArrayLitt. Use a loop to display the contents of each object in the ArrayList.
Design a class named Person with fields for holding a person's name, address, and telephone number (all as Strings). Write a constructor that initializes all of these values, and mutator and accessor methods for every field. Next, design a class named Customer, which inherits from the Person class. The Customer class should have a String field for the customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write a constructor that initializes...
Create a data class named Automobile that implements the Comparable interface. Give the class data fields for make, model, year, and price. Then add a constructor, all getters, a toString method that shows all attribute values, and implement Comparable by using the year as the criterion for comparing instances. Write a program named TestAutos that creates an ArrayList of five or six Automobiles. Use a for loop to display the elements in the ArrayList. Sort the Arraylist of autos by...
Using JAVA* Design a class named Person with fields for holding a person’s name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class’s fields. Next, design a class named Customer, which extends the Person class. The Customer class should have a field for a customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write one or more constructors and the appropriate mutator...
Define a class named Payment that contains an instance variable "paymentAmount" (non-static member variable) of type double that stores the amount of the payment and appropriate accessor (getPaymentAmount() ) and mutator methods. Also create a method named paymentDetails that outputs an English sentence to describe the amount of the payment. Override toString() method to call the paymentDetails() method to print the contents of payment amount and any other details not included in paymentDetails(). Define a class named CashPayment that is...
Room Class....... in JAVA!!!!! Write a class named Room that has the following fields: Length: Double variable that holds the rooms length(in feet). Breadth: The double variable that holds the rooms breadth(in feet). Height: Double variable that holds rooms height in feet. Color: String object that holds the color you want the room to be painted with. The class should have a constructor to initialize the fields for a particular instance (or object) of the class as given: All double...
4. RetailItem Class Write a class named RetailItem that holds data about an item in a retail store. The class should have the following fields: • description. The description field references a String object that holds a brief description of the item. • unitsOnHand. The unitsOnHand field is an int variable that holds the number of units currently in inventory. • price. The price field is a double that holds the item’s retail price. Write a constructor that accepts arguments...
Implement an abstract class named Person and two subclasses named Student and Staff in Java. A person has a name, address, phone number and e-mail address. A student has a credit hour status (freshman, sophomore, junior, or senior). Define the possible status values using an enum. Staff has an office, salaray, and date-hired. Implement the above classes in Java. Provide Constructors for classes to initialize private variables. Getters and setters should only be provided if needed. Override the toString() method...
text format
separate by
1)
2)
Point3D Class Write a class named Point3D that extends the generic Point class you wrote in Tuesday's lab. The Point3D class is generic but restricted to Number and its subclasses. The Point3D class has a z field that contains the z coordinate. Provide a constructor for the Point3D class. Provide an accessor and mutator for field Z. Demonstrate in a main method. PointList Class Write a class named PointList that keeps a list of...
Design a JAVA program with the class named Computer that creates a computer object that stores the computer's brand, model, memory (in GB) and storage (in GB). The class must contain the following instance variables and methods. All variable and method names must match the specifications listed below exactly. Instance Variables: - a String variable named brand - a String variable named model - an int variable named memory - an int variable named storage Methods: The accessor and mutator...