[Solved] SOLVED: Lab 3 – Decisions – Planets

30 $

File Name: SOLVED:_Lab_3_–_Decisions_–_Planets.zip
File Size: 367.38 KB

SKU: [Solved] SOLVED: Lab 3 – Decisions – Planets Category: Tag:

Or Upload Your Assignment Here:


Lab 3 – Decisions

Here is a table that describes the planets in our solar system numbered according to their distance from the sun:

1. Mercury2. Venus3. Earth4. Mars5. Jupiter6. Saturn7. Uranus8. Neptune

Use the code below to input an integer from the user. Write a switch statement that examines the integer and prints out the name of the corresponding planet. Print an error message if an invalid integer is entered.

“`javaimport java.util.Scanner;

public class Planets

{

public static void main(String[] args)

{

Scanner scan = new Scanner(System.in);

System.out.print(“Enter a planet number from the sun: “);

int planet = scan.nextInt();

// Your code goes here …

}

}“`

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED: Lab 3 – Decisions – Planets
30 $