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
After configuring the role services on the Remote Desktop server, Jabez creates a collection for the Marketing group in the orga
lawyer [7]

The option that  is true is option C: Jabez created a shared folder that is accessible to remote servers in the collection.

<h3>What are servers?</h3>

A server is known to be a form a computer program or device that helps to give a service to a given computer program and its user.

Note that in the case above, The option that  is true is option C: Jabez created a shared folder that is accessible to remote servers in the collection.

Learn more about servers from

brainly.com/question/17062016

#SPJ1

8 0
2 years ago
Due to the wildfires in Australia, the Red Cross has asked for assistance in determining how many trees were destroyed per hecta
kobusy [5.1K]

Answer:

1.trees_destroyed_per_hectare = 456/2.47  

2. input(no_of_hectares)  

3. no_of_trees_destroyed =no_of_hectares * trees_destroyed_per_hectare

4. print(no_of_trees_destroyed)

Explanation:

1.trees_destroyed_per_hectare = 456/2.47  //conversion of tress destroyed   per acres to hectare

2. input(no_of_hectares)  // get input from user in hectares that how many hectares are destroyed

3. no_of_trees_destroyed =no_of_hectares * trees_destroyed_per_hectare // total number of trees destroyed by fire on given day and given area

4. print(no_of_trees_destroyed)

7 0
3 years ago
In an array list the time complexity of the remove function is identical to the time complexity of the ____ function.
yaroslaw [1]

Answer:

C. is Full

Explanation:

In an array list the time complexity of the remove function is identical to the time complexity of the ''isFull'' function.

3 0
4 years ago
Read 2 more answers
How technology works?
Nastasia [14]

First of all, technology refers to the use of technical and scientific knowledge to create, monitor, and design machinery. Also, technology helps in making other goods.

5 0
2 years ago
A gamer typing their name into the computer is an example of:
vova2212 [387]

user input I think I'm not sure though

3 0
3 years ago
Read 2 more answers
Other questions:
  • David needs to create a password. He uses "rtjjkliusfvwr." Which of the following best explains the weakness in his password?
    9·2 answers
  • HELP PL
    13·2 answers
  • He primary purpose for attackers to send port scanning probes to hosts is to identify which ports are open. true false
    5·1 answer
  • This term describes two or more arrays that hold related data, and the related elements in each array are accessed with a common
    15·1 answer
  • Which of the following choices best completes the above flowchart?
    11·1 answer
  • You must write a pseudocode process called swapSort which should sort a list of numbers using an algorithm called swap sort.
    13·1 answer
  • A type of user interface that features on- screen objects, such a menus and icons, manipulated by a mouse.
    7·1 answer
  • Practice using filters and tables using this document.
    9·1 answer
  • A feature that allows you to quickly apply the contents of one cell to another cell or range of cells selected.
    6·1 answer
  • Complete the sentence.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!