Initial Basics – Algebra – Problem #21
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
In an automobile company, the number of cars manufactured on a day, say n, depends on which day of the week it is. Monday means Day 1, Tuesday means Day 2, ..., Sunday means Day 7. For Day 1, number of manufactured cars per day is given by the number of available machines (say m, which is a user input). For Day 2, n is m + m/2 + m/4, rounded off to the nearest integer. For Day 3 and Day 6, k machines (k is user input) are kept under inspection, and so n becomes m-k + (m-k)/2 + (m-k)/4, rounded off to the nearest integer. For the other days, n is m plus a boosting fraction f of m, rounded off to the nearest integer, where the fraction f is positive and less than 1 and taken as user input. Given the week day (1 to 7) as input, find the number of manufactured cars (n) on that day. You should use switch-case statements. Example 1 Enter the number of machines: 11 Enter the day number (1-7): 1 Number of manufactured cars = 11. Example 2 Enter the number of machines: 11 Enter the day number (1-7): 2 Number of manufactured cars = 19. Example 3 Enter the number of machines: 11 Enter the day number (1-7): 3 Enter no. of machines under inspection: 5 Number of manufactured cars = 11. Example 4 Enter the number of machines: 11 Enter the day number (1-7): 4 Enter boosting fraction: .33 Number of manufactured cars = 15.