Given: If you buy less than 10 robots, each robot will cost $15,000 each. If you
ID: 3638995 • Letter: G
Question
Given:If you buy less than 10 robots, each robot will cost $15,000 each. If you buy between 11 and 20 robots, however, the first 10 will cost $15,000 each, and the rest will cost $12,500 each. If you buy more than 20 robots, the first 10 will cost $15,000 each, the next ten cost $12,500 each, and all the remaining robots will cost $10,000 each.
Find:
Write a PSEUDOCODE for solving the above problem after prompting the user for the number of robots to purchase. Next, use your pseudo code to find out the cost of 5, 15, and 37 robots.
I'm given a tip that the solution requires conditional operations.
Explanation / Answer
int num_robots; int cost=1; input num_robots; /*number of robots to be bought if(num_robots 20) { cost=(10*15000)+( (10)*(12500) )+( (num_robots-20)*(10000) ); } output cost;Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.