Writing a program that uses a loop to count to 4 Assignments | Online Assignment Services

You should turn in a brief report by the end of class.

Your report should include:
• 5 points: Your name
• 20 points:A single question describing what the question is asking
• 30 points:Your code
• 10 points:Your code output
• 10 points:A discussion of your solution

using System;

public class Program
{
public static void Main()
{
Console.WriteLine(“Whaddup World”);
int count = 0;
while(4 >= count){
Console.WriteLine(count);
count++;
}
for (int loopCount = 0; loopCount <=4; loopCount++){
Console.WriteLine(loopCount);
}
}
}

and

import java.util.Scanner;

public class LoopTutorial {

public static void main(String[] args) {
// TODO Auto-generated method stub

Scanner userInput = new Scanner(System.in);
boolean terminationCondition = false;

while (!terminationCondition) {
System.out.println(“Choose an option!\n”
+ “1 for Say Hello\n”
+ “2 for count to 4\n”
+ “3 for close program\n”);
int userDecision = userInput.nextInt();
switch (userDecision) {
case 1:
System.out.println(“Hello”);
break;
case 2:
for (int i = 0; i <= 4; i++) {
System.out.println(i);
}
break;
case 3:
terminationCondition = true;
break;
default:
System.out.println(“Not a valid command”);
break;
}
}//closes while loop
System.out.println(“Goodbye!”);
}

}

Solution:

Looking for help with your homework?
Grab a 30% Discount and Get your paper done!

30% OFF
Turnitin Report
Formatting
Title Page
Citation
Place an Order

Calculate your paper price
Pages (550 words)
Approximate price: -