Microsoft Visual C#
Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
bartleby

Concept explainers

Question
Book Icon
Chapter 2, Problem 16E
Program Plan Intro

Program Plan:

Following variables are used in the program:

Month: It is the enumeration that stores the months and their respective integer values.

stringMon: Enumeration type to store the name of month.

intMonth: To store the integer value of month.

UserInput: To take input from user in string format.

Following functions are used in the program:

Console.ReadLine(): To input month value in string format.

Convert.ToInt32(): To convert the entered value in string format to integer format.

Console.WriteLine(): To display the name of month entered by user and other instructions to user.

Summary Introduction:

Program will use define an enumeration Month which will store the month name and its respective integer value. Then Main() method will be used to ask the user to input the integer value of any month. The entered value will be stored in a variable type of Month enumeration after typecasting and name of month will be provided to the user. Program Description:

Purpose of the program asks user to input an integer number within range of 1 to 12 and provide respective month name for the integer.

Blurred answer
Students have asked these similar questions
Write a program that generates a random number in the range of 1 through 100, and asks the user to guess what the number is.  If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." If the user guesses the number, the application should congratulate the user and generate a new random number so the game can start over. Additional Enhancement: Enhance the game so it keeps count of the number of guesses that the user makes.  When the user correctly guesses the random number, the program should display the number of guesses.
Write a program that generates a random number in the range of 1 through 100, and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” If the user guesses the number, the application should congratulate the user and then generate a new random number so the game can start over.Optional Enhancement: Enhance the game so it keeps count of the number of guesses that the user makes. When the user correctly guesses the random number, the program should display the number of guesses.
The temperature of an object changes when it absorbs or loses thermal energy. It is possible to relate the amount of heat transferred, denoted by a variable q with units of joules, to the quantity of the substance m, by the following equation: q = mCsΔt  Write a script that calculates amount of heat transferred for any amount of aluminum. Aluminum has a specific heat Cs = 0.897.  The program should prompt the user to enter values for Δt and m, and should return the amount of heat transferred in units of joules. Test the program with values of 20 ℃ and 100 g.

Chapter 2 Solutions

Microsoft Visual C#

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT