INSY 4305 Lab 5 Instructions

  1. Create a class CellPhone with following fields: (see AccountRecord.java)

String model,  manufacturer,  double retailPrice

Add Constructors, Accessors and Mutators.

  1. Create another class CellPhoneList to store Cellphone objects in an ArrayList. This class can be used to serialize cellphones into an XML file.(see AccountRecords.java)

 

  1. Create a program CellPhoneStoreApp.java (see Lab_5_Help.java) with menu options as shown below:

 

 

 

Sample Run

——–Menu Selections——-

1 – Create cell phones and write in text file

2 – Display cell phones from text file

3 – Create cell phones and write in xml file

4 – Display cell phones from xml file

5 – Exit

? 1

Creating cellphone objects and write into txt file…

cellphone list stored in txt file.

——–Menu Selections——-

1 – Create cell phones and write in text file

2 – Display cell phones from text file

3 – Create cell phones and write in xml file

4 – Display cell phones from xml file

5 – Exit

? 2

Reading cellphone list from txt file

Model               Manufacturer        retail price

Pixel1              Google                  899.99

11                  Apple                   499.99

13                  Apple                  1009.99

S21                 SamSung                 600.00

Xperia              Sony                    614.22

——–Menu Selections——-

1 – Create cell phones and write in text file

2 – Display cell phones from text file

3 – Create cell phones and write in xml file

4 – Display cell phones from xml file

5 – Exit

? 3

creating cellphone objects and store in XML file…

cellphone list stored in XML file.

——–Menu Selections——-

1 – Create cell phones and write in text file

2 – Display cell phones from text file

3 – Create cell phones and write in xml file

4 – Display cell phones from xml file

5 – Exit

? 4

Reading cell phone list from XML file…

Model               Manufacturer        retail price

Pixel 6             Google                  899.99

iPhone 11 Pro       Apple                   499.99

iPhone 13 Pro       Apple                  1009.99

Galaxy S21 5G       SamSung                 600.00

Sony Xperia 5 III   Sony                    614.22

——–Menu Selections——-

1 – Create cell phones and write in text file

2 – Display cell phones from text file

3 – Create cell phones and write in xml file

4 – Display cell phones from xml file

5 – Exit

? 5

Powered by WordPress