PLEASE help me with ODD #\'s!! 5 & 7! PLEASE show work and C# ONLY! THANKS! 5. a
ID: 3597222 • Letter: P
Question
PLEASE help me with ODD #'s!! 5 & 7! PLEASE show work and C# ONLY! THANKS!
5. a. Write a program named Ch If the value entered is greater than 12 or less than 1, display a eckMonth that prompts a user to enter a birth HIU onerwise, display the valid month with a message such as 3 is a valid mon b. Write a program named C month with a message such as 3 is a valid month. and day. Display an error message if the month is invalid (no heckMonth2 that prompts a user to enter a birth month t 1 through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between 1 and 29 for February). If Account numbers sometimes contain a check digit that is the the month and day are valid, display them with a message. 6. result of a mathematical calculation. The inclusion of the digit in an account number helps ascertain the number is a valid one. Write an application named CheckDigit ti to enter a four-digit account number and The number whether at asks a user determines whether it is a valid number. is valid if the fourth digit is the remainder when the number represented the first three digits of the four-digit number is divided by 7. For example, 7770 valid, because 0 is the remainder when 777 is divided by 7. The next problems rely on the generation of a random number. You o create a random number that is at least min but less than max using the following statements: an Random ranNumberGenerator new RandomO int randomNumber; randomNumber = ranNumberGene rator. Next (min, max); Write a program named GuessingGame that generates a random number between 1 and 10. (In other words, in the example above, min is 1 and max is 11.) Ask a user to guess the random number, then display the random number and a message indicating whether the user's guess was too high, too low, or correct. 7.Explanation / Answer
5)
a)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationc
{
class CheckMonth
{
static public int birthMonth;
static void Main(string[] args)
{
Console.WriteLine("Please enter the Birth Month: ");
birthMonth = Convert.ToInt32(Console.ReadLine());
if (birthMonth > 12 || birthMonth < 1)
{
Console.WriteLine("Error: Not a valid Month");
}
else
{
Console.WriteLine(birthMonth + " is a valid Month");
}
Console.ReadLine();
}
}
}
OUTPUT:
Please enter the Birth Month:
3
3 is a valid Month
b)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationc
{
class CheckMonth2
{
static public int birthMonth;
static public int day;
static void Main(string[] args)
{
Console.WriteLine("Please enter the Birth Month: ");
birthMonth = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please enter the Day: ");
day = Convert.ToInt32(Console.ReadLine());
if (birthMonth > 12 || birthMonth < 1)
{
Console.WriteLine("Error: Not a valid Month");
Console.ReadLine();
return ;
}
if (birthMonth == 2 && day < 1 || day > 29)
{
Console.WriteLine("Not a valid day for month");
}
else if (day < 1 || day > 31)
{
Console.WriteLine("Not a valid day for month");
}
else
{
Console.WriteLine(birthMonth +" Month and "+day +" day are valid.");
}
Console.ReadLine();
}
}
}
OUTPUT:
Please enter the Birth Month:
2
Please enter the Day:
28
2 Month and 28 day are valid.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.