{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework and midterm

0 else answer 70 systemoutprintlnthe answer is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: u specify.”); System.out.print(“Enter a number: “); int numberOfHellos = input.nextInt(); for(int i=0; i < numberOfHellos; i++){ System.out.println(“hello”); } } } 7 26. Write a program that asks the user for a floating point number. If the number the user enters is less than 10, print out that number plus 5. If the number is greater to or equal to 10 but less than 20, print out that number plus 6. If the number is greater than or equal to 20, print out that number plus 7. import java.util.Scanner; public class MyProg { public static void main(String args) { Scanner input = new Scanner(System.in); System.out.println("Please enter a number:"); double userIn = input.nextDouble(); double answer = userIn; if (userIn < 10) { answer += 5.0; } else if (userIn < 20) { answ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online