computers

posted by .

Write a program that will emulate a cash register. Ask the user to input the price of three items. Get a subtotal. Determine the tax (6% ) of the subtotal. Find the total amount of the sale subtotal plus tax. Display the price of each item, subtotal amount, tax amount and final amount.

  • computers -

    maybe you can work with this as a model


    @p = ();
    $st = 0;

    for ($i=1 ; $i <= 3 ; $i++) {
    print "Price of item #$i: ";
    $v = <STDIN>; chomp $v;
    $p[$i] = $v;
    $st += $v;
    }
    $tax = $st * 0.06;
    $total = $st + $tax;
    print "\nItem Price\n";
    for ($i=1 ; $i <= 3 ; $i++) {
    printf "%4d %12.2f\n",$i,$p[$i];
    }
    printf "%s\n","-"x17;
    printf "subtotal: %7.2f\ntax: %12.2f\ntotal: %10.2f\n",$st,$tax,$total


    sample run:


    perl jiskha1.pl
    Price of item #1: 1763.2
    Price of item #2: .85
    Price of item #3: 12

    Item Price
    1 1763.20
    2 0.85
    3 12.00
    -----------------
    subtotal: 1776.05
    tax: 106.56
    total: 1882.61

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Math

    I posted this problem last night and someone answered. I followed all the steps that this person told me to do and I don't get the right answer. The right answer is suppose to be $23.54. What am I doing wrong?
  2. Web application development JSP

    Below is the following jsp code for a homework assignment im working on. Im allow four input text fields in which a customer can enter the amount of each fruit they want to buy, a submit button, and a reset button. After a customer …
  3. logic and design

    You have been contracted by a local antique store to design an algorithm determining the total purchases and sales tax. According to the store owner, the user will need to see the subtotal, the sales tax amount, and the total purchase …
  4. Programming in Python

    A customer in a store is purchasing five items. Design a program in python that asks for the price of each item, and then displays the subtotal of the sale, the amount of the sales tax , and the total. Assume the sales tax is 6 percent.
  5. Program Logic Design

    The Chocolate Delights Candy Company needs to add the following functionality to its cash register: When a customer is checking out, the cash register needs to store the required data pertaining to each item the customer is buying. …
  6. Computer Science

    Write a program   that reads the subtotal and the gratuity rate in this order, then computes the gratuity and total. For example, if the user enters "10" for subtotal and "15" (%) for gratuity rate, the program   displays "1.5" …
  7. computers

    compute the unit price for products sold the program should input the name and price of an item and its weight in pounds and ounces. Then it should determine and display the unit price write a pseudo code program that will allow a …
  8. Pseudocode

    Produce the algorithm for the problem above [this will include five “get” statements to input item 1, item 2, item 3, item 4 and item 5; three math statements to process the subtotal, tax and total; and three “display” statements …
  9. Computer programming

    I am trying to write a program in C that would be used by a car rental company. This program finds the subtotal, tax amount(6%) and finally the total. The user enters in how many days the car was rented and how many miles were driven. …
  10. computer science

    Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should …

More Similar Questions