Question

**C# Visual Basic** You will create a program that uses an enumerator to store the days...

**C# Visual Basic**

You will create a program that uses an enumerator to store the days of the week and months of the year and then ask the user for their birthday and then print it out to the screen along with their age. Your output should look like this:

Enter the day of the week you were born on (sun, mon, ect...):

Enter the month you were born in (Jan, Feb, ect...):

Enter the day of the month you were born on (1, 2, 3 ect...):

You were born on Sunday, Jan 6th 1969 and you are currently 48 years old

**C#**

0 0
Add a comment Improve this question Transcribed image text
Answer #1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Task3
{
class Program
{
enum day{
monday = 1, tuesday, wednesday, thursday, friday, saturday, sunday
}
enum month
{
january = 1, febuary, march, april, may, june, july, august, september, october, november, december
}
static bool TodayReached(int CDate, int CMonth, int CYear, int Date, int Month, int Year)
{
if (CDate == Date && CMonth == Month && CYear == Year) return true;   
else return false;
}
static void Main(string[] args)
{
Console.WriteLine("Enter the day of the week you were born on? 1-7? ");
string Day1 = System.Console.ReadLine();
day BirthDay = (day)Convert.ToInt32(Day1);
//System.Console.WriteLine(BirthDay);

Console.WriteLine("Enter the month you were born in? 1-12? ");
string Month1 = System.Console.ReadLine();
month BirthMonth = (month)Convert.ToInt32(Month1);
//System.Console.WriteLine(BirthMonth);

Console.WriteLine("Enter your Birth Date? 1-31? ");
string BirthDate = System.Console.ReadLine();
//System.Console.WriteLine(BirthDate);

Console.WriteLine("Enter your Birth Year? ");
string BirthYear = System.Console.ReadLine();
//System.Console.WriteLine(BirthYear);

int Age = 0;
int dayspassed = 0;
int Month = Convert.ToInt32(Month1);
int Date = Convert.ToInt32(BirthDate);
int Year = Convert.ToInt32(BirthYear);

//int Month = 1;
//int Date = 6;
//int Year = 1969;

int CMonth = 3;
int CDate = 20;
int CYear = 2019;

while(!TodayReached(CDate, CMonth, CYear, Date, Month, Year))
{
dayspassed++;
Date++;
if (Date > 30)
{
Date = 1;
Month++;
if (Month > 12)
{
Month = 1;
Year++;
}
}
}
Age = dayspassed / 365;
System.Console.WriteLine("You Were Born On " + BirthDay + ", " + BirthMonth + " " + BirthDate + "th " + BirthYear + " and you are currently " + Age + " years old.");
}
}
}

COMMENT DOWN FOR ANY QUERIES,

AND LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.

Add a comment
Know the answer?
Add Answer to:
**C# Visual Basic** You will create a program that uses an enumerator to store the days...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need to create a Java class file and a client file that does the following:  Ask user to enter Today’s date in the fo...

    I need to create a Java class file and a client file that does the following:  Ask user to enter Today’s date in the form (month day year): 2 28 2018  Ask user to enter Birthday in the form (month day year): 11 30 1990  Output the following: The date they were born in the form (year/month/day). The day of the week they were born (Sunday – Saturday). The number of days between their birthday and today’s...

  • Please create the following program in C format with Visual Studio Declare any variables needed Print...

    Please create the following program in C format with Visual Studio Declare any variables needed Print “Hello my name is (add your name here)” onto the screen. Ask the user for a number. Scan the number from the user. Multiply the number by 123. Print the original number and the product back onto the screen. Ask the user for a letter. Scan the letter from the user. Make an uppercase and a lowercase version of the letter (use toupper and...

  • c++ please :) First, ask the user to enter a year (4-digit) and what week day...

    c++ please :) First, ask the user to enter a year (4-digit) and what week day does this year starts with (String) For example, the year 2018 starts with the week day "Friday". In this case, the calendar should start from January 1 which is Friday, 2018 Your program should produce a formatted calendar for the specified year and there should be a blank line after each month. Moreover, the month and the year should be centered over each month....

  • Write a C# program that prints a calendar for a given year. Call this program calendar....

    Write a C# program that prints a calendar for a given year. Call this program calendar. The program prompts the user for two inputs:       1) The year for which you are generating the calendar.       2) The day of the week that January first is on, you will use the following notation to set the day of the week:             0 Sunday                     1 Monday                   2 Tuesday                   3 Wednesday       4 Thursday                 5 Friday                      6 Saturday Your program should...

  • Write a C# program that prints a calendar for a given year. Call this program calendar....

    Write a C# program that prints a calendar for a given year. Call this program calendar. This program needs to use Switch Case in order to call the methods and format to print each month. The program prompts the user for two inputs:       1) The year for which you are generating the calendar.       2) The day of the week that January first is on, you will use the following notation to set the day of the week:      ...

  • Write a Java program for a fortune teller. The program should begin by asking the user...

    Write a Java program for a fortune teller. The program should begin by asking the user to enter their name. Following that the program will display a greeting. Next, the program will ask the user to enter the month (a number 1-12) and day of the month (a number 1-13) they were born. Following that the program will display their zodiac sign. Next, the program will ask the user their favorites color (the only choices should be: red, green and...

  • Visual Basic Question In the Chap9 folder of the student sample programs, you will find the...

    Visual Basic Question In the Chap9 folder of the student sample programs, you will find the following files: GirlNames.txt - This file contains a list of the 200 most popular names given to girls born in the United States from 2000 to 2012 BoyNames.txt - This file contains a list of the 200 most popular names given to boys born in the United States from 2000 to 2012 Create an application that reads the contents of the two files into...

  • Write a function to determine the day of the week a person was born given his...

    Write a function to determine the day of the week a person was born given his or her birthday. The following steps should be used to find the day of the week corresponding to any date from 1901 through the present. In the following explanation, the following terms will be helpful. Assuming I type in my birthday as "6 10 1981": The month is 6. The day of the month is 10. The year is 1981. Find the number of...

  • Visual C# C# Visual Studio 2017 You are to create a class object called “Employee” which included eight private variable...

    Visual C# C# Visual Studio 2017 You are to create a class object called “Employee” which included eight private variables - firstN - lastN - idNum -wage: holds how much the person makes per hour -weekHrsWkd: holds how many total hours the person worked each week. - regHrsAmt: initialize to a fixed amount of 40 using constructor. - regPay - otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods: -...

  • In Python, Create a program that will calculate how much money you will save. Your program...

    In Python, Create a program that will calculate how much money you will save. Your program needs to ask the user how many months they wish to save for, how many weeks during a month they wish to save and how much money they are willing to save with each weekly paycheck. It will then total the amount saved for each month and in total. Your input statement needs to look like the following: How many months are you saving...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT