Programming Homework Help

Alabama Aviation College Eclipse Java Programming Questions

 

Question 1-3 (question 2 and 3 attached. question 1 has been answered 70% just need some little help. work must be done in esclipse 

Instructions

In Eclipse, create a new Java Project named “UnitConverter”
In the UnitConverter project, create a package named “main
Inside the main package, create a class named Converter, which has a main(String[]) method.Inside this main(String[]) method, your code should follow this pattern:
Create an int variable named menuSelection
Inside a while loop, with the condition menuSelection != /*last menu option */Using System.out.println(), print a menu with numbered options. For example:Please select an option: 1. Cups to Teaspoons 2. Miles to Kilometers 3. US Gallons to Imperial Gallons 4. Quit
Use a Scanner object to collect the user’s menuSelection
switch on the selection to collect the user’s quanity of the first unit, convert to the second unit, and print the output

ques 1.

package main;

import java.util.Scanner;

public class Converter {

public static void main(String[] args) {

int menuselection =0;

String converter;

Scanner sc = new Scanner (System.in);

while(“menuSelection != /*last menu option */” != null);

}

{

System.out.println(“Select your option:”);

System.out.println(“Converter”);

System.out.println(“1. Cups to Teaspoons 1”);

System.out.println(“2. Miles to Kilometers 2”);

System.out.println(“3. US Gallons to Imperial Gallons 3”);

System.out.println(“4. Quit 4”);

System.out.println(“Enter option(1-4): “);

menuSelection = sc.nextInt();

//logic

switch(menuSelection)

{

case 1:

converter=”Cups to Teaspoons”;

break;

case 2:

converter=”Miles to Kilometers”;

break;

case 3:

converter=”Gallons to Imperial Gallons”;

break;

case 4:

converter=”Quit”;

}

//output

System.out.println(“your converter+converter”);

}

1. so you have to “check menuSelection. If it’s 4, user wants to quit

while(menuSelection != 4) {

// put the rest of the logic in here, including your print statements”

2. we have to make sure the whole thing isn’t in the string. we want to use concatenation:

// “your converter: ” + converter

System.out.println(“your converter+converter”);

}