Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Project Weight on Other Planets

Answers 10-6

import java.io.*;
import java.util.*;
public class Weight
{
public static void main(String [] args)
{
Scanner kbReader = new Scanner(System.in);
System.out.print(What is you weight on the Earth? );
double earthWeight = kbReader.nextDouble( );
System.out.println( );
System.out.println(1. Voltar);
System.out.println(2. Krypton);
System.out.println(3. Fertos);
System.out.println(4. Servontos);
System.out.println( );
System.out.print(
Selection? );
int choice = kbReader.nextInt( );
double factor = 1;
String planet = ;
switch(choice)
{
case 1:
planet = Voltor;
factor = .091;
break;
case 2:
planet = Krypton;
factor = .720;
break;
case 3:
planet = Fertos;
factor = .865;
break;
case 4:
planet = Servontos;
factor = 4.612;
break;
}
double planetWeight = factor * earthWeight;
System.out.println(\nYour weight on + planet + would be + planetWeight );
}
}

You might also like