Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C please. Thank you DESCRIPTION Write a program that prompts a user to enter the name, quantity, and price of items added to a

image text in transcribedimage text in transcribed

In C please. Thank you

DESCRIPTION Write a program that prompts a user to enter the name, quantity, and price of items added to a shopping cart. Your program will use 2 new typedef structs to store the information, then calculate and output the shopping cart and total cost. Your first new typedef should: be named itemCost contain 2 data members: o a double itemPrice o an integer itemQuantity Your second new typef should: be named itemToPurchase contain 2 data members: o a 50 character string itemName o cost of type itemCost Your program will need the following 3 functions: GetItem o has no parameters o prompts the user for all the data members of an itemToPurchase struct o returns an itemTo Purchase stuct PrintItem o has an itemToPurchase parameter o prints all the data members of an itemToPurchase struct CostofShoppingCart o has an array of itemToPurchase and the size of the array as parameters o returns the total cost of the items in the cart as a double Within your main function you will need to: create a shopping cart: 10 element struct array prompt the user for the number of items to enter into the cart (up to 10) use GetItem to prompt for and read data into the array use PrintItem to print the shopping cart use costofShoppingCart to calculate the total cost of the shopping cart NOTES: Be sure to include your function prototypes before main, and your function definitions after main. There is more than one way to solve this problem using different function definitions. However, you must define the functions and use them in your progam as described above to receive credit for the assignment Sample output (sample input shown with underline): How many items in your cart? 2 Item 1 Enter the item name: Bread Enter the item quantity: 2 Enter the item price: 5.00 Item 2 Enter the item name: Water Enter the item quantity: 3 Enter the item price: 2.50 Shopping Cart Bread 2 @ $ Water 3 @ $ 5.00 = 2.50 = $ 10.00 $ 7.50 TOTAL COST: $ 17.50

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions

Question

1. What is predictive data analytics?

Answered: 1 week ago

Question

LO1 Summarize the organizations strategic planning process.

Answered: 1 week ago