Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'ve tried my best writing the code but I have no idea how to make item number

ID: 3669095 • Letter: I

Question

I've tried my best writing the code but I have no idea how to make item number function like 1 -> 2.99. We are programming in C.

2) We are managing a small retail store that sells 4 products Item number Retail price 2.99 1.99 9.99 4.49 4 gram that takes a pair of numbers as follows Write a pro item number Your program should calculate and display the total retail value of the products sold. Your program should use a switch statement to help determine the price of each product 3) Your program should adhere to the following LO specification "Enter the item number and quantity sold:" Read a pair of numbers "The total retail value for xx units of item yy is: $zz.ln"

Explanation / Answer

You can use structs.
Look up my code for the init function.

#include <stdio.h>

struct items{
   int itemno;
   double price;
   int sold;
}Inventory[4];

void init(){
  
   Inventory[0].itemno = 1;
   Inventory[0].price = 2.99;
   Inventory[0].itemno = 2;
   Inventory[0].price = 1.99;
   Inventory[0].itemno = 3;
   Inventory[0].price = 9.99;
   Inventory[0].itemno = 4;
   Inventory[0].price = 4.49;
}

int main(){
   init();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote