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

it\'s required for the steps to be like this answer in the second and third pape

ID: 3822676 • Letter: I

Question


it's required for the steps to be like this answer in the second and third papers



Question In this submission, you are required to write a material order recording program which applies file Fo foatures. When the progrwm started, it should list the infommation about all the materials available (from upricelist.bxt') and allow user to choose the material that helshe wants to order. Next, the program will prompt the user to enter the weight kg) that helshe wants to order. Finally, the program will ask the user if the order is confimed If it is confirmed, the program will record append the order to the text file name "order.txt". Together with this assignment question document, a txt file name "pricelist.bt" is provided which comprises the data of a list of materials. The data includes material name, grade, and price per kg in usd. The suggested algorithm for this program is as below, note that you can chose to or to not follow the algorithm provided but must fulfil the items listed in marking scheme. 1. Program started. 2. Create and initialize variables and arrays. 3, Load all the data from the "pricelist tit" into the array created in step 2. 4. List and display the materials loaded into the array in step 3. 5, Prompt the user to choose the material by enters the index number 5,1 Record the option entered by the 6. Prompt the user to enter the weight in kg for the order, 6.1 Record the weight. 7. Based on the option and weight recorded in step 5&6, calculate and prompt the user if the order is oonfirmed. 7.1 If it is confirmed, then append the order to the file"order.Dct". 7.2 Else inform the user the data has not been recorded. 8, Prompt if the user would like to continue order. 8.1 lf yes, restart step 4. 8.2 Else, end the program. 9. Program end.

Explanation / Answer

#include <stdlib.h>
#include <stdio.h>
#define COBALT_PRICE 5.99
#define NICKEL_PRICE 3.99
#define TIN_PRICE 4.99
#define ZINC_PRICE 5.99
#define IRON_PRICE 4.99
#define URANIUM_PRICE 6.99

main(){

int ch = 0;
double tp = 0;

printf("Welcome to MINING CO.! ");
printf("May a take your order? ");

do{
printf("Menu: ");
printf("1. Cobalt $%.2lf ", COBALT_PRICE );
printf("2. Nickel $%.2lf ", NICKEL_PRICE );
printf("3. Tin $%.2lf ", TIN_PRICE );
printf("4. Zinc $%.2lf ", ZINC_PRICE );
printf("5. Iron $%.2lf ", IRON_PRICE);
printf("6. Uranium $%.2lf ", URANIUM_PRICE);
printf("7. Exit ");
printf("Enter an your choice: );

switch(ch){
case 1:
tp += COBALT_PRICE ;
break;
case 2:
tp += NICKEL_PRICE ;
break;
case 3:
tp += TIN_PRICE ;
break;
case 4:
tp += ZINC_PRICE ;
break;
case 5:
tp += IRON_PRICE;
break;
case 6:
tp += URANIUM_PRICE;
break;
case 7:
printf("Than you for ordering at MINING CO.! ");
break;
default:
printf("Invalid Selection. ");
break;
}

printf("Total so far: $%.2lf ", tp);

} while (ch != 7);

printf("Your order is $%.2lf ", tp);
printf("Thankyou For Shopping With Us. ");
printf("Have a nice day!. ");

system("pause");
}

Hope it helps.