Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 Convert the following loop into a for loop bool keepGoing = true; int count = 0 ; while ( keepGoing & & count
Question
Convert the following loop into a for loop
bool keepGoing true;
int count ;
while keepGoing & & count
Console.WriteLinecount;
Console.WriteLineKeep going?";
keepGoing Convert.ToBooleanConsoleReadLine;
count;
Question
The code in question currently has no validation. Check for the following cases:
Nonnumeric input
Negative number input
Number greater than input
If any of the validation cases are encountered, output "error" to the user. Other deposit amount to the user.
Question
Convert the following ifelse into a switch case:
Console.WriteLineEnter a username";
string ulnput Console.ReadLine;
if ulnput "admin"
Console.WriteLineNice try";
else if ulnput "user"
Console.WriteLineToo common!";
else if ulnput "password"
Console.WriteLineThat comes later";
else
Console.WriteLineUsername set!";
Question
Write a program to simulate feeding ducks at a park.
Repeat the following commands until the user wants to stop feeding ducks or has fed ducks:
Ask the user how many ducks they would like to feed
Display the number of ducks the user has fed
Ask the user if they would like to continue
If repetition stops because the user fed ducks or more, display the message "you have been overwhelmed by ducks."
Question
Complete the method addingEvens
The method has an integer return and two integer parameters
The method returns the sum of all even integer parameter values
A value is even if it is divisible by
is considered an even number for this problem
If no parameters are even, the method returns
For example: addingEvens returns addingEvens returns addingEvens returns
Call the method from the main times with the following arguments
Two even numbers
One even and one odd number
Two odd numbers
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started