Untitled
unknown
plain_text
2 years ago
1.0 kB
3
Indexable
import java.util.Scanner; public class Assignment3 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); boolean cont = true; while(cont){ System.out.println("Enter 1, 2, 3, or 4"); System.out.println("1 ..."); System.out.println("2 ..."); System.out.println("3 ..."); System.out.println("4 ..."); int input = scanner.nextInt(); if(input == 4){ cont = false; }else{ System.out.println("Enter A Number:"); int userNum = scanner.nextInt(); if(input == 1){ //print userNum squared }else if(input == 2){ //print userNum cubed }else if(input == 3){ //ask user for another number and do userNum ^ new number } } } } }
Editor is loading...