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

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 5, Problem 14E

In Chapter 4, you created a program that generates a random number, allows a user to guess it, and displays a message indicating whether the guess is too low, too high, or correct. Now, create a modified program called GuessingGame2 in which the user can continue to enter values until the correct guess is made. After the user guesses correctly, display the number of guesses made.

Recall that you can generate a random number whose value is at least min and less than max using the following statements:

Random ranNumber = new Random();

int randomNumber;

randomNumber = ranNumber.Next(min, max);

Blurred answer
Students have asked these similar questions
For this question, you will write a program that prompts the user to enter an integer value between 1 and 1000 (exclusive). Your program should then print out a sequence of numbers between the given value and 1 (inclusive) following the pattern below:For a given number ai, If ai is even, then ai+1 = floor(ai / 2) If ai is odd, then ai+1 = 3ai + 1 Your program should stop printing numbers once the sequence reaches the value of 1. If the user enters a number that is not between 1 and 1000 (exclusive), print "Invalid input." and prompt the user for a number again. This sequence is referred to as the Collatz sequence. The Collatz Conjecture states that this sequence will eventually reach the value of 1 for any starting number, a fact that has not yet been proven by modern mathematics! Note: floor(x) means that x should be rounded down to the nearest integer.
Write a program that calculates the estimated hours and minutes for a trip given the number of miles traveled and the speed in miles per hour. Specifically, write a program that Welcomes the user to the Travel Time Calculator. Asks user for number of miles traveled(allow user to enter fractional values) Asks user for the speed in miles per hour (allow user to enter fractional values) Calculates the number of hours and minutes for the trip to the nearest integer value. Hint: You can use the built-in function round that rounds a given number to the rounded integer value. e.g. round(4) will return 4, round(4.125) will return 4, round(4.5) will return 4 and round (4.75) will return 5. Prints the number of hours and minutes for the trip. Here are some sample runs:
Write a program that computes the molecular weight of a carbohydrate (ingrams per mole) based on the number of hydrogen, carbon, and oxygenatoms in the molecule. The program should prompt the user to enter thenumber of hydrogen atoms, the number of carbon atoms, and the numberof oxygen atoms. The program then prints the total combined molecularweight of all the atoms based on these individual atom weights:Atom Weight(grams I mole)H 1.00794c 12.01070 15.9994For example, the molecular weight of water (H20) is: 2(1.00794) +15.9994 = 18.01528.
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
Python Tutorial #10; Math Functions in Python; Author: Art of Engineer;https://www.youtube.com/watch?v=OviXsGf4qmY;License: Standard YouTube License, CC-BY