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
Phishing (pronounced fishing) is malware sent through e-mail that looks like a legitimate message from a trusted sender. The goa
never [62]

Answer:

this is true

Explanation:

the answer is true

5 0
3 years ago
Read 2 more answers
7. When using find command in word we can search?
lesya [120]

Answer:

When using find command in word we can search all of the above

6 0
3 years ago
If you interview a dentist to learn about her experiences on the job, she is considered a secondary source of information. Pleas
Alik [6]

A source can be either primary or secondary. The statement that if you interview a dentist to learn about her experiences on the job, she is considered a secondary source of information is false. A primary source provides direct or firsthand  experience, while a secondary source of information describes or analyzes the primary source. In this case, when the dentist is interviewed she is considered as primary source because she is speaking about herself and her experience.


6 0
3 years ago
Read 2 more answers
To speed up item insertion and deletion in a data set, use ____.
jok3333 [9.3K]

To speed up item insertion and deletion in a data set, use B. linked lists.

Hope this helps!

5 0
3 years ago
Directory services store information in a heirarchical structure. Which statements about Organizational Units (OUs) of a directo
NeX [460]

Answer:B

Explanation:

Specific files within an OUs or container are called object.

5 0
3 years ago
Other questions:
  • If you have a 3D printer please show me a vid of you making something because I'm interested in getting one. Ty! Also can someon
    12·1 answer
  • Respecting culture in the workplace means understanding that
    5·2 answers
  • What command is most effective at identifying different types of files?
    6·1 answer
  • Write a java program to print the following series: <br>1 5 9 13 17...n terms​
    13·2 answers
  • Please help! Answer this question if you know computer science very well. I need help with computer science.
    13·1 answer
  • Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0
    9·1 answer
  • Please HELP me it a test and it due rn. Please no links
    9·1 answer
  • how risk can impact each of the seven domains of a typical IT infrastructure: User, Workstation, Local Area Network (LAN), Local
    7·1 answer
  • When you pass a double variable to a method, the method receives ______.a) a copy of the memory addressb) the reference of the v
    12·1 answer
  • What refers to a set of instructions executed in order?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!