hi guys ,
can you please suggest how to create a object from csv data in java…
this is following question please suggest how to proceed.
Create a Driver class
Create Person class with the typical member data: id, age, first name, last name
Derive Shopper class from Person:
- Include the following members in Shopper class:
private int shopperId;
private double budget;
private AbstractItemFactory itemFactory = null;
private AbstractCartFactory cartFactory = null;
private Cart cart = null;
Create Shopper object from CSV data:
“id,age,firstName,LastName,shopperId,budget”
20 POINTS: Design a Cart class:
- Derived from AbstractCart
- Include the following member in Cart class:
private List items = null;
10 POINTS: Design an MobileShopperCart class
- Derived from Cart
15 POINTS:
Design a CartFactory class
- Derived from AbstractCartFactory
- Implemented as a Lazy Singleton
- Return MobileShopperCart objects (as Cart)
Design a Item class:
- Derived from AbstractItem
Design a HiTechItem class:
- Derived from Item
Design a HiTechItemFactory
- Derived from AbstractItemFactory
- Implemented as a Lazy Singleton
- Return HiTechItem objects (as AbstractItem)
: Complete the Implementation of the supplied demo() method in Shopper class (use demo() method below)
Be certain that the demo method is implemented to perform the following:
Create Shopper cart using CartFactory:
Create Shopper tasks using HiTechItemFactory:
Add 4 items to Shopper cart from following CSV string data:
"1,150,HDTV,32 inch HD TV”
“2,400,4KTV,53 inch 4k UHD Smart TV”
“3,100,Monitor,Computer Monitor”
“4,1500,OLEDTV,55 inch OLED Smart TV”
Driver must call the following static demo method in your Shopper class:
public static void demo() {
System.out.println("\n\t" + Shopper.class.getName() + “.demo()…”);
Shopper obj = new Shopper("1,17,Dan,Peters,101,2000.0");
System.out.println(obj);
// add shopper cart Factory (CartFactory) to Shopper object
// use Cart Factory to add shopper Cart to Shopper object
// add shopper Item Factory (HiTechItemFactory) to Shopper object
// use shopper Item factory to add all items to Shopper Cart
// show shopper cart
// remove Monitor item from cart
// show shopper cart
// show shopper shopping results
System.out.println("SHOPPING BUDGET: " + shoppingBudget);
System.out.println("SHOPPING CART TOTAL: " + totalCartDollars);
System.out.println("SHOPPING BALANCE: $" + (shoppingBudget - totalCartDollars));
System.out.println("\n\t" + Shopper.class.getName() + ".demo()... done!");
}