Java Lesson 10 - Switch Statement
Videos |
|
Text |
|
READ text then COMPLETE assignments below.
Your browser does not support viewing this document. Click here to download the document.
Assignments |
|
Exercises
Download Exercises for lesson below and submit it when done
BP EX 10.docx
Project…Weight on Other Planets
Write a program that will determine the user’s weight on another planet. The program should
ask the user to enter his weight (on earth) via the keyboard and then present a menu of the
other mythical planets. The user should choose one of the planets from the menu, and use a
switch (with an integer) statement to calculate the weight on the chosen planet. Use the
following conversion factors to determine the user’s weight on the chosen planet.
ask the user to enter his weight (on earth) via the keyboard and then present a menu of the
other mythical planets. The user should choose one of the planets from the menu, and use a
switch (with an integer) statement to calculate the weight on the chosen planet. Use the
following conversion factors to determine the user’s weight on the chosen planet.
Planet Multiply weight by
Voltar 0.091
Krypton 0.720
Fertos 0.865
Servontos 4.612
A typical output screen will be similar to the following:
What is your weight on the Earth? 135
1. Voltar
2. Krypton
3. Fertos
4. Servontos
Selection? 1
Your weight on Voltor would be 12.285