computers

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.

  1. 👍
  2. 👎
  3. 👁
  1. 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

    1. 👍
    2. 👎

Respond to this Question

First Name

Your Response

Similar Questions

  1. Programming

    Write a pseudocode to represent the logic of a program that allows a user to enter an hourly pay rate and hours worked. The program outputs the user's gross pay

  2. Programming

    Draw a flowchart or write pseudo code to represent the logic of a program that allows the user to enter values for the current year and the user’s birth year. The program outputs the age of the user this year. Preferably a

  3. computer science

    In this exercise you will create a program that computes the average of a collection of values entered by the user. The user will enter 0 as a sentinel value to indicate that no further values will be provided. Your program should

  4. intro to computer programming

    Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount. Your program should use a

  1. CIS

    Draw a flowchart or write pseudocode to represent the logic of a program that allows the user to enter a value. The program multiplies the value by 10 and outputs the result.

  2. java programming

    1. Time Calculator Write a program that asks the user to enter a number of seconds. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the

  3. C++

    // Program: name of program // Author: your name // Date Written: date you began writing the program /* Abstract: Brief description of the program */ Include in-line comments in the body of your program. You can convert

  4. gtuc

    1. WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. 2. CALCULATE THE PRICE OF AN ITEM COSTING 100 GHANA CEDIS AFTER A DISCOUNT OF 10% IS APPLIED TO IT. 3. WRITE A PROGRAM TO CALCULATE THE

  1. C Programming

    Write a program that prompts the user to enter a temperature, followed by a letter representing Celsius (C) or Fahrenheit (F). Then prompt the user for the conversion type and print the results to the screen with one decimal

  2. Computer Science

    Write a program that Will prompt a user to enter his/her name and number.use a while loop that will display the user name times the entered number

  3. programming logic

    The program will accept user input to store the student's first and last name . If the name is ZZZ, then the program will end. The program will accept: a text entry for the class number (e.g., CGS 1000, COP 1000, etc.) a numeric

  4. pre cal

    A cash register contains only ten dollar and tenty dollar bills. It contains three times as many ten dollar bills as twenty dollar bills and the total amount of money in the cash register is $1,950. How many ten dollar bills are

You can view more similar questions or ask a new question.