Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an application that works like a shopping cart system for abook store. On

ID: 3609450 • Letter: C

Question

Create an application that works like a shopping cart system for abook store. On the Student CD you will find a file namedBookPrices.txt. This file contains the names and prices of variousbooks, formatted in the following fashion:
I Did It Your Way, 11.95
The History of Scotland, 14.50
Learn Calculus in One Day, 29.95
Feel the Stress, 18.50

Each line in the file contains the name of a book, followed by acomma, followed by the book's retail price. When your applicationbegins execution, it should read the contents of the file and storethe book titles in a list component. The user should be able toselect a title from the list and add it to a shopping cart, whichis simply another list component. The application should havebuttons or menu items that allow the user to remove items from theshopping cart of all selections, and check out. When the userchecks out, the application should calculate and display thesubtotal of all the books in the shopping cart, the sales tax(which is 6 percent of the subtotal), and the total.

Explanation / Answer

please rate - thanks this should get you started. I've never done this stuff before, and I'm just not enjoying doingthis, but hopefully it will get you started. The stuff in redis where I'm stuck. You probably learned how to do it inclass. I'm self taught import java.awt.*; import java.applet.*; import java.awt.event.*; import java.util.*; import java.io.*; public class shoppingcart extends Applet implements ItemListener,ActionListener                                        {private Choice sell,buy; double price[]= new double[50],Total=0; Label subtotallabel = new Label("subtotal"); TextField subtotalfield = new TextField(10); Label taxlabel = new Label("tax"); TextField taxfield = new TextField(10); Label totallabel = new Label("total"); TextField totalfield = new TextField(10); Button calcbutton = new Button("check out"); Button emptybutton = new Button("empty cart"); Button clearbutton = new Button("removeitem");       public void init()       {String input,name;        int n,i=0,count;               sell=new Choice();        sell.add("choose one");                  try {         Scanner in=newScanner(new File("BookPrices.txt"));         while(in.hasNext())               {input=in.nextLine();                   n=input.indexOf(',');                   name=input.substring(0,n);               sell.add(name);              price[i++]=Double.parseDouble(input.substring(n+1,input.length()));                   System.out.println(name+" "+price[i-1]);                   }        }catch (IOException e) {       System.out.println("IO Error:");        }        count=i;           add(sell);              sell.addItemListener(this);           buy=new Choice();         buy.add("YourSelections");        // meal.add("7 meals perweek");           add(buy);          buy.addItemListener(this);          add(subtotallabel);         add(subtotalfield);        subtotalfield.setEditable(false);           add(taxlabel);         add(taxfield);        taxfield.setEditable(false);           add(totallabel);         add(totalfield);        totalfield.setEditable(false);           add(emptybutton);           add(clearbutton);         add(calcbutton);                   }              public voiditemStateChanged(ItemEvent e)              {intchosen=0,i=0;                 System.out.println("index1= "+chosen+" "+e.getSource());                  if(e.getSource()==buy)             { chosen=buy.getSelectedIndex();               System.out.println("index= "+chosen);               sell.add(Double.toString(price[i-1]));                              }                                                                                                               }                            public void actionPerformed(ActionEvente)            {String inputString;          intx1,x2,y1,y2;                  if(e.getSource()==calcbutton)             {              }          if(e.getSource()==clearbutton)                {                   }            if(e.getSource()==emptybutton)               {                   }            }            }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote