1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PSYCHO15rus [73]
3 years ago
5

Write a program named as calcPrice.c that formats product information entered by the user and calculate the total amount of purc

hase.

Computers and Technology
1 answer:
Colt1911 [192]3 years ago
4 0

Answer:

Here is the calcPrice.c program:

#include <stdio.h>   //to use input output functions

int main(void)  {  //start of main method

   int itemNo, month, day, year, quantity;  //declares variables to hold item number, quantity, and date

   float unitPrice; //declare variable to hold price per unit

   printf("Enter item number: ");  // prompts user to enter item number

   scanf("%d", &itemNo);  //reads item number from user and stores it in itemNo variable

   printf("Enter unit price: ");  // prompts user to enter unit price

   scanf("%f", &unitPrice);  //reads input unit price and stores it in unitPrice variable

   

    printf("Enter quantity: ");  //prompts user to enter quantity

   scanf("%d", &quantity);  //reads input quantity and stores it in quantity variable

   printf("Enter purchase date (mm/dd/yyyy): ");  //prompts user to enter purchase date

   scanf("%d/%d/%d", &month, &day, &year);  //reads input date and stores it in month, day and year variables

    float totalAmount = unitPrice * quantity;  //computes the total amount

   printf("\nItem\tUnit Price\tQTY\tPurchase Date\tTotal Amount\n");  //displays the item, unit price, qty, purchase data and total amount with tab space between each

   printf("%d\t$%5.2f\t%d\t%.2d/%.2d/%d\t$%5.2f\n", itemNo, unitPrice,quantity, month, day, year,totalAmount);   }    //displays the values of itemNo, unitPrice, quantity, month, day, year and computed totalAmount with tab space between each

Explanation:

Lets suppose user enters 583 as item number, 13.5 as unit price, 2 as quantity and 09/15/2016 as date so

itemNo = 583

unitPrice = 13.5

quantity = 2

month = 09

day = 15

year = 2016

totalAmount is computed as:

  totalAmount = unitPrice * quantity;

 totalAmount = 13.5* 2

totalAmount = 27.00

Hence the output of the entire program is:

Item    Unit Price      QTY     Purchase Date   Total Amount      

583     $  13.50           2           09/15/2016         $  27.00  

The screenshot of the program along with its output is attached.

You might be interested in
Decrypt this secret message if your able to a lot will come..
nata0808 [166]

Answer:-

Failure

and 0008

Hope This Helps

7 0
3 years ago
Read 2 more answers
Which one cost more Broken bones or a Broken Computer? Explian ur answer
vladimir1956 [14]
Broken bones cost more, because hospital bills are a lot more than to get a computer fixed.
4 0
3 years ago
Read 2 more answers
What does HMI stand for and why is it important in the field of robotics
Rudik [331]

A Human-Machine Interface (HMI) is a graphic terminal that allows the robot operator to control, monitor, and collect data from the robot system.

(https://www.robots.com/faq/what-is-a-hmi)

5 0
3 years ago
What is the full form of PDP​
PtichkaEL [24]

Answer:

<em>Plasma display panel </em>(PDP)

Explanation:

<em>Plasma display panel </em>(PDP) is a type of flat panel display that uses small cells containing electrically charged ionized gases or plasmas, to produce an image. PDP consists of millions of tiny gas-filled compartments, or cells, between two panels of glass with parallel electrodes deposited on their surfaces.

3 0
4 years ago
Give three reasons why you think ETL functions are mostchallenging in data warehouse environment.
adell [148]

Answer:

Because of the nature of the source systems ETL functions are challenging.Reasons are as following:-

1. There are various source systems are very  and contrasting.

2. There is usually a requirement to deal with source systems on different platforms or Operating Systems.

3. Quality of data is uncertain in many old source systems that have developed gradually over time.

5 0
3 years ago
Other questions:
  • Despite its vivid design, the website for Lolly's Bookstore did not seem to attract customers who lingered. In fact, most websit
    13·1 answer
  • What two programming systems uses numbers and text?
    6·1 answer
  • Translation of a file into a coded format that occupies less space than the original file is called
    15·1 answer
  • A device which lets you interact with the computer
    6·2 answers
  • A wireless network does not benefit like a wired network does, when it comes to collision reduction. Which device reduces collis
    6·1 answer
  • Waygate's residential Internet modem works well but is sensitive to power-line fluctuations. On average, this product hangs up a
    6·1 answer
  • Java Programming Using nested if statement For a student to be accepted in XYZ College, the student must meet the following requ
    5·1 answer
  • Please help i will give you brainiest and 5 stars answer the question!!!!!!!!!!!!!!!!!!!!!!!!!
    7·1 answer
  • _________________________ are the countable products resulting from a program, while ________________________ are the changes in
    9·1 answer
  • Technology __________ guides how frequently technical systems are updated, and how technical updates are approved and funded.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!