B. The main function should perform the following: • Initialize the variable NB_LAPTOP with the sum of the first digit a
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
B. The main function should perform the following: • Initialize the variable NB_LAPTOP with the sum of the first digit a
//////Part B ////////////////// //// Please enter the cost of 4 laptops: 150 50 250 170 Part B is created by student: yyy xxx- ID = 40375 Item Original Price laptop-1 laptop-2 laptop-3 laptop-4 150.00 50.00 250.00 170.00 Total price with discount: 610.400 Total before discount: 620.000 Average price with discount: 152.600 Average price before discount: 155.000 Price with discount 145.50 50.00 250.00 164.90
Problem Write a C program that calculates the price of all laptops/destops and average rank of a company. The program's design should use only the main function. In the program, constant statement and else statement cannot be used. You should write code based on the covered materials; It is not allowed to include statements that are not covered in the class until the end of week 2. The main function should run successfully with different scenarios. The main function should perform the following: A. The main function should perform the following: • Initialize the variable NB with your section number. For example, if your section is F3, the value of NB will be 3. If your section is M5, the value of NB will be 5. If your section is M1 or F1 or M2 or F2, the value of NB should be equal to 5. Prompt the user to enter the rank and the gender of NB employees by using a do while loop. The rank value should be from 1 to 5 and the gender value should be 'M' or 'F' only. (15 points) Print your section number, your first name, your last name and your AUM ID on the screen. For example, if your first name = xxx, last name=yyy, section number = F3 and ID = 40375, the program should print "Part A is created by student yyy xxx-section F3 - ID= 40375". (3 points) • Calculate and print the average rank of male employees (1) and the average rank of all employees (2). (12 points)
3 M 4 F 3 M /////Part A ///// Enter data of 3 employees: Part A is created by student yyy xxx- section F3 ID=40375 The average rank 1 is 3.00 The average rank 2 is = 3.33