Cars program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • javasomething
    New Member
    • Feb 2007
    • 9

    #16
    hello I am suppose to do this assignment can someone help me.

    Shopping Cart

    In this assignment, you will write an application to print receipts for purchases made at a store. The project consists of three classes:

    1. The Item class represents an item that is for sale. An Item has a number, a name, and a price. For instance:

    123, T-Shirt, $15.99

    2. The Purchase class represents a customer's purchase of one or more Items. Each Purchase has a date, a subtotal, tax, and a number of items.

    3. A driver class.

    The UML class diagrams for Item and Purchase are shown here:

    Item

    - num
    - name
    - price
    _______________ _

    + Item(num, name, price)
    + getNum
    + setName
    + getName
    + setPrice
    + getPrice
    + toString



    Purchase

    - Item[] items
    - Date date
    - subtotal
    - tax
    - numItems
    + TAX_RATE
    - MAX_ITEMS
    _______________ _

    + Purchase()
    + add(Item)
    + getSubtotal()
    + getTax()
    + total()
    + printReceipt()


    In the Purchase class, initialize TAX_RATE to 0.086, and MAX_ITEMS to 100 in a static block. Then, write the methods shown in the diagram:

    Purchase() Allocates memory for the items array to MAX_ITEMS

    Initializes date to the current date
    date = new Date();

    Initializes subtotal, tax, total and numItems to zero



    add(Item item): Checks to see if MAX_ITEMS is reached. If so, prints “Array is full.” Otherwise: Add new item to array at position numItems

    Increment numItems

    Adjust the subtotal to include the price of the new item

    Adjust the tax to include the tax on the new item



    getSubtotal(): returns subtotal


    getTax(): returns tax


    total(): returns total (subtotal plus tax)


    printReceipt(): prints a summary of the purchase, including: “SALES RECEIPT"

    date of purchase

    a list of purchases, including item numbers, names and prices

    the subtotal, tax, and total for the purchase, all formatted as currency.


    write a driver class that contains a main method.

    Instantiate at least three new items.

    Create a new purchase

    Add several items to the purchase

    Print a receipt

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #17
      Originally posted by javasomething
      hello I am suppose to do this assignment can someone help me.

      Shopping Cart

      In this assignment, you will write an application to print receipts for purchases made at a store. The project consists of three classes:

      1. The Item class represents an item that is for sale. An Item has a number, a name, and a price. For instance:

      123, T-Shirt, $15.99

      2. The Purchase class represents a customer's purchase of one or more Items. Each Purchase has a date, a subtotal, tax, and a number of items.

      3. A driver class.

      The UML class diagrams for Item and Purchase are shown here:

      Item

      - num
      - name
      - price
      _______________ _

      + Item(num, name, price)
      + getNum
      + setName
      + getName
      + setPrice
      + getPrice
      + toString



      Purchase

      - Item[] items
      - Date date
      - subtotal
      - tax
      - numItems
      + TAX_RATE
      - MAX_ITEMS
      _______________ _

      + Purchase()
      + add(Item)
      + getSubtotal()
      + getTax()
      + total()
      + printReceipt()


      In the Purchase class, initialize TAX_RATE to 0.086, and MAX_ITEMS to 100 in a static block. Then, write the methods shown in the diagram:

      Purchase() Allocates memory for the items array to MAX_ITEMS

      Initializes date to the current date
      date = new Date();

      Initializes subtotal, tax, total and numItems to zero



      add(Item item): Checks to see if MAX_ITEMS is reached. If so, prints “Array is full.” Otherwise: Add new item to array at position numItems

      Increment numItems

      Adjust the subtotal to include the price of the new item

      Adjust the tax to include the tax on the new item



      getSubtotal(): returns subtotal


      getTax(): returns tax


      total(): returns total (subtotal plus tax)


      printReceipt(): prints a summary of the purchase, including: “SALES RECEIPT"

      date of purchase

      a list of purchases, including item numbers, names and prices

      the subtotal, tax, and total for the purchase, all formatted as currency.


      write a driver class that contains a main method.

      Instantiate at least three new items.

      Create a new purchase

      Add several items to the purchase

      Print a receipt
      Start a new thread for this one and give it a title that best describes your problem

      Comment

      • javasomething
        New Member
        • Feb 2007
        • 9

        #18
        I need to finish this assignment can somone do it by tommorrow 9:00 AM plz



        Shopping Cart

        In this assignment, you will write an application to print receipts for purchases made at a store. The project consists of three classes:

        1. The Item class represents an item that is for sale. An Item has a number, a name, and a price. For instance:

        123, T-Shirt, $15.99

        2. The Purchase class represents a customer's purchase of one or more Items. Each Purchase has a date, a subtotal, tax, and a number of items.

        3. A driver class.

        The UML class diagrams for Item and Purchase are shown here:

        Item

        - num
        - name
        - price
        _______________ _____

        + Item(num, name, price)
        + getNum
        + setName
        + getName
        + setPrice
        + getPrice
        + toString



        Purchase

        - Item[] items
        - Date date
        - subtotal
        - tax
        - numItems
        + TAX_RATE
        - MAX_ITEMS
        _______________ _

        + Purchase()
        + add(Item)
        + getSubtotal()
        + getTax()
        + total()
        + printReceipt()







        In the Purchase class, initialize TAX_RATE to 0.086, and MAX_ITEMS to 100 in a static block. Then, write the methods shown in the diagram:

        Purchase() Allocates memory for the items array to MAX_ITEMS

        Initializes date to the current date
        date = new Date();

        Initializes subtotal, tax, total and numItems to zero



        add(Item item): Checks to see if MAX_ITEMS is reached. If so, prints “Array is full.” Otherwise: Add new item to array at position numItems

        Increment numItems

        Adjust the subtotal to include the price of the new item

        Adjust the tax to include the tax on the new item



        getSubtotal(): returns subtotal


        getTax(): returns tax


        total(): returns total (subtotal plus tax)


        printReceipt(): prints a summary of the purchase, including: “SALES RECEIPT"

        date of purchase

        a list of purchases, including item numbers, names and prices

        the subtotal, tax, and total for the purchase, all formatted as currency




        For help with formatting, see Java's printf command. A sample "receipt" is shown here:



        Now, write a driver class that contains a main method.

        Instantiate at least three new items.

        Create a new purchase

        Add several items to the purchase

        Print a receipt


        Generate an API for your Item class using the javadoc utility.
        Include Item.html in your folder when you submit the assignment.
        You do not need to print it out.

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #19
          Originally posted by javasomething
          I need to finish this assignment can somone do it by tommorrow 9:00 AM plz



          Shopping Cart

          In this assignment, you will write an application to print receipts for purchases made at a store. The project consists of three classes:

          1. The Item class represents an item that is for sale. An Item has a number, a name, and a price. For instance:

          123, T-Shirt, $15.99

          2. The Purchase class represents a customer's purchase of one or more Items. Each Purchase has a date, a subtotal, tax, and a number of items.

          3. A driver class.

          The UML class diagrams for Item and Purchase are shown here:

          Item

          - num
          - name
          - price
          _______________ _____

          + Item(num, name, price)
          + getNum
          + setName
          + getName
          + setPrice
          + getPrice
          + toString



          Purchase

          - Item[] items
          - Date date
          - subtotal
          - tax
          - numItems
          + TAX_RATE
          - MAX_ITEMS
          _______________ _

          + Purchase()
          + add(Item)
          + getSubtotal()
          + getTax()
          + total()
          + printReceipt()







          In the Purchase class, initialize TAX_RATE to 0.086, and MAX_ITEMS to 100 in a static block. Then, write the methods shown in the diagram:

          Purchase() Allocates memory for the items array to MAX_ITEMS

          Initializes date to the current date
          date = new Date();

          Initializes subtotal, tax, total and numItems to zero



          add(Item item): Checks to see if MAX_ITEMS is reached. If so, prints “Array is full.” Otherwise: Add new item to array at position numItems

          Increment numItems

          Adjust the subtotal to include the price of the new item

          Adjust the tax to include the tax on the new item



          getSubtotal(): returns subtotal


          getTax(): returns tax


          total(): returns total (subtotal plus tax)


          printReceipt(): prints a summary of the purchase, including: “SALES RECEIPT"

          date of purchase

          a list of purchases, including item numbers, names and prices

          the subtotal, tax, and total for the purchase, all formatted as currency




          For help with formatting, see Java's printf command. A sample "receipt" is shown here:



          Now, write a driver class that contains a main method.

          Instantiate at least three new items.

          Create a new purchase

          Add several items to the purchase

          Print a receipt


          Generate an API for your Item class using the javadoc utility.
          Include Item.html in your folder when you submit the assignment.
          You do not need to print it out.
          Read this .

          Comment

          • javasomething
            New Member
            • Feb 2007
            • 9

            #20
            All right i wont print anymore homework. But i have some questions:

            What is a class member?
            What is the difference between a do loop and a while loop?
            What is the difference between a static and instance variables?
            Write a statement to declare a char variable c and assign it the value X.

            Thanks

            Comment

            • r035198x
              MVP
              • Sep 2006
              • 13225

              #21
              Originally posted by javasomething
              All right i wont print anymore homework. But i have some questions:

              What is a class member?
              What is the difference between a do loop and a while loop?
              What is the difference between a static and instance variables?
              Write a statement to declare a char variable c and assign it the value X.

              Thanks
              All except one of these questions are covered in detail here.

              Comment

              • RedSon
                Recognized Expert Expert
                • Jan 2007
                • 4980

                #22
                Originally posted by javasomething
                All right i wont print anymore homework. But i have some questions:

                What is a class member?
                What is the difference between a do loop and a while loop?
                What is the difference between a static and instance variables?
                Write a statement to declare a char variable c and assign it the value X.

                Thanks
                ROFLMFAO!

                "Write a statement to declare a char variable c and assign it the value X."

                Comment

                Working...