Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Problem 34

A supermarket awards coupons depending on how much a customer spends on groceries. For example, if you spend \(\$ 50\), you will get a coupon worth cight percent of that amount. The following table shows the percent used to calculate the coupon awarded for different amounts spent. Write a program that calculates and prints the value of the coupon a person can receive based on groceries purchased. Here is a sample run: Please enter the cost of your groceries: 14 You win a discount coupon of \(\$ 1.12\). ( \(8 x\) of your purchase)

Problem 36

Write a program that prompts the user for a wavelength value and prints a description of the corresponding part of the electromagnetic spectrum, as given in the following table.

Problem 39

A minivan has two sliding doors. Each door can be opened by cither a dashboard switch, its inside handle, or its outside handle. However, the inside handles do not work if a child lock switch is activated. In order for the sliding doors to open, the gear shift must be in park, and the master unlock switch must be activated. (This book's author is the long-suffering owner of just such a vehicle.) Your task is to simulate a portion of the control software for the vchicle. The input is a sequence of values for the switches and the gear shift, in the following order: \- Dashboard switches for left and right sliding door, child lock, and master unlock (O for off or 1 for activated) \- Inside and outside handles on the left and right sliding doors (O or 1) A the gear shift setting (one of P N D \(123 \mathrm{R}\) ). Print "left door opens" and/or "right door opens" as appropriate. If neither door opens, print "both doors stay closed".

Problem 43

A mass \(m=2\) kilograms is attached to the end of a rope of length \(r=3\) meters, The mass is whirled around at high speed. The rope can withstand a maximum tension of \(T=60\) Newtons. Write a program that accepts a rotation speed \(v\) and determines whether such a speed will cause the rope to break. Hint \(T=m v^{2} / r\).

Problem 44

A mass \(m\) is attached to the end of a rope of length \(r=3\) meters. The rope can only be whirled around at speeds of \(1,10,20\), or 40 meters per second. The rope can withstand a maximum tension of \(T=60\) Newtons. Write a program where the user enters the value of the mass \(m\), and the program determines the greatest speed at which it can be whirled without breaking the rope. Hint: \(T=m v^{2} / r\).

Problem 45

The average person can jump off the ground with a velocity of \(7 \mathrm{mph}\) without fear of leaving the planet. However, if an astronaut jumps with this velocity while standing on Halley's Comet, will the astronaut ever come back down? Create a program that allows the user to input a launch velocity (in mph) from the surface of Halley's Comet and determine whether a jumper will return to the surface. If not, the program should calculate how much more massive the comet must be in order to retum the jumper to the surface. Hint: Escape velocity is \(v_{\text {ecape }}=\sqrt{2 \frac{G M}{R}}\), where \(G=6.67 \times 10^{-11} \mathrm{Nm}^{2} / \mathrm{kg}^{2}\) is the gravitational constant, \(M\) is the mass of the heavenly body, and \(R\) is its radius. Halley's comet has a mass of \(2.2 \times 10^{14} \mathrm{~kg}\) and a diameter of \(9.4 \mathrm{~km}\).

Access millions of textbook solutions in one place

  • Access over 3 million high quality textbook solutions
  • Access our popular flashcard, quiz, mock-exam and notes features
  • Access our smart AI features to upgrade your learning
Get Vaia Premium now
Access millions of textbook solutions in one place

Recommended explanations on Computer Science Textbooks