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 MS, 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. 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 Calculate and print the average rank of male employees (1) and the average rank of all employees (2).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
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.
• 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"
Calculate and print the average rank of male employees (1) and the average rank of all
employees (2).
B. The main function should perform the following:
•
Initialize the variable NB LAPTOP with the sum of the first digit and the second digit of
your AUM ID. if your ID is 40375, the value of NB LAPTOP will be 4.
• Prompt the user to enter the price (float) of NB
LAPTOP laptops by using a while loop.
Print your first name, last name and your student ID on the screen. For example, if your
name = xxx yyy, and ID=40375, the program should print "Part B is created by student
yyy xxx-ID-40375"
Print the average price of all laptops before and after discount as shown below in the
sample output. The discount is applicable on laptops that cost from 100 to 200. The
discount amount is equal to the value of your section number. For example, if your section
number is F3, the discount amount is equal to 3%
C. The main function should then perform the following:
•
Prints in the screen 5 lines that contains your AUM ID. For example, if your AUM ID is
40375, the number 40375 to be printed per line depends on your AUM ID. If your AUM ID
is 40375, the first line should contain 4 times "40375", the second line should contain 0
times "40375", the third line should contain 3 times "40375", the fourth line should
contain 7 times "40375" and the fifth line should contain 5 times "40375". You can use
only printf instruction in this part
Initializes two integers B and A with the first and second digits of your AUM ID,
respectively. If your ID is 40375, the value of A will be 0 and the value of B will be 4.
The main function should initialize a variable M with the largest of the two numbers A and
B using an if statement. For example, if the value of A is 0 and the value of B is 4, the value
of M will be 4
Write by c
programing
• Prompt the user to enter the price of M chairs. The main function then prints the price of
each chair after discount as shown below in the sample output. The main function then
prints the total price after discount of all chairs which get a discount of 10%. Note that
you cannot use a loop in this section.
Price
Price < 1000
1000 < Price <-2000
Price > 2000
D. The program should adhere the following requirements:
• Write explanatory comments for your code.
"
. The name of the C file is equal to your student ID. For example, if your student ID - 40375,
the name of the file will be "40375.c".
This program is created by:
a-
b-
C-
d-
Discount
10%
15%
20%
Write your first name, your last name, the course code CS159, your section number and
your AUM ID as comments at the top of the code as shown below:
If your name is xxx yyy, your ID is 40375 and your section is F3, comments should be:
/*
Page 2 of 4
Student name= xxx yyy
Id=40375
Section F3
Course code: CS 159
Transcribed Image Text: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. • 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" Calculate and print the average rank of male employees (1) and the average rank of all employees (2). B. The main function should perform the following: • Initialize the variable NB LAPTOP with the sum of the first digit and the second digit of your AUM ID. if your ID is 40375, the value of NB LAPTOP will be 4. • Prompt the user to enter the price (float) of NB LAPTOP laptops by using a while loop. Print your first name, last name and your student ID on the screen. For example, if your name = xxx yyy, and ID=40375, the program should print "Part B is created by student yyy xxx-ID-40375" Print the average price of all laptops before and after discount as shown below in the sample output. The discount is applicable on laptops that cost from 100 to 200. The discount amount is equal to the value of your section number. For example, if your section number is F3, the discount amount is equal to 3% C. The main function should then perform the following: • Prints in the screen 5 lines that contains your AUM ID. For example, if your AUM ID is 40375, the number 40375 to be printed per line depends on your AUM ID. If your AUM ID is 40375, the first line should contain 4 times "40375", the second line should contain 0 times "40375", the third line should contain 3 times "40375", the fourth line should contain 7 times "40375" and the fifth line should contain 5 times "40375". You can use only printf instruction in this part Initializes two integers B and A with the first and second digits of your AUM ID, respectively. If your ID is 40375, the value of A will be 0 and the value of B will be 4. The main function should initialize a variable M with the largest of the two numbers A and B using an if statement. For example, if the value of A is 0 and the value of B is 4, the value of M will be 4 Write by c programing • Prompt the user to enter the price of M chairs. The main function then prints the price of each chair after discount as shown below in the sample output. The main function then prints the total price after discount of all chairs which get a discount of 10%. Note that you cannot use a loop in this section. Price Price < 1000 1000 < Price <-2000 Price > 2000 D. The program should adhere the following requirements: • Write explanatory comments for your code. " . The name of the C file is equal to your student ID. For example, if your student ID - 40375, the name of the file will be "40375.c". This program is created by: a- b- C- d- Discount 10% 15% 20% Write your first name, your last name, the course code CS159, your section number and your AUM ID as comments at the top of the code as shown below: If your name is xxx yyy, your ID is 40375 and your section is F3, comments should be: /* Page 2 of 4 Student name= xxx yyy Id=40375 Section F3 Course code: CS 159
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education