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 in python code Project 11-1: Birthday Calculator Create a program that accepts a name and...

    Write in python code Project 11-1: Birthday Calculator Create a program that accepts a name and a birth date and displays the person's birthday the current day, the person's age, and the number of days until the person's next birthday Console Birthday Calculator Enter name: Joel Enter birthday (MM/DD/YY): 2/4/68 Birthday: Sunday, February 04, 1968 Today: Joel is 48 years old. Joel's birthday is in 73 days Tuesday, November 22, 2016 Continue? (y/n): y Enter name: Django Enter birthday (MM/DD/YY):...

  • 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...

  • Description: This project focuses on creating a Java class, Date.java, along with a client class, DateCleint.java,...

    Description: This project focuses on creating a Java class, Date.java, along with a client class, DateCleint.java, which will contain code that utilizes your Date.java class. You will submit both files (each with appropriate commenting). A very similar project is described in the Programming Projects section at the end of chapter 8, which you may find helpful as reference. Use (your own) Java class file Date.java, and a companion DateClient.java file to perform the following:  Ask user to enter Today’s...

  • 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 C++ program that determines the user's age after the   user enters both the current...

    Write a C++ program that determines the user's age after the   user enters both the current date and hisher birthdate as 3   integers:                yyyy mm dd                                                                                             Define a class which is named DateType and will be used to     declare 2 objects: "birthday" and "today". The class will have a function "output" which will display the date in conventional form (like it is above next to Date Assigned: Month dd, yyyy and it will have a second function named     “input”...

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