Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete C program that performs the following tasks: Declare two arrays that can hold up to 15 items each. The first array holds

Write a complete C program that performs the following tasks:

Declare two arrays that can hold up to 15 items each. The first array holds item IDs (integers), and the second array holds prices (doubles).

Ask the user how many items they would like to input.

Assume that the number entered will be valid (1 to 15)

For each item, get the ID and price from the user, storing to the appropriate arrays.

Note: The order here should be: get ID 1, get price 1, get ID 2, get price 2, etc.

Do not prompt for each ID and price, just prompt once and read them all in.

Ask the user which item they would like to find. The user will input an item ID number.

Assume that only a valid ID will be entered.

Using the selected ID number, find the item and output the item ID and price.

Format the price to 2 decimal places.

Sample program run:

How many items? 3 Enter 3 ID and item pairs: 1 1.10 2 2.10 3 3.20 Which item would you like to find? 2 Price of item 2 is 2.10 

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago