Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# I need help to recode my code into two methods, If user is a member, next method should show the guessing game to get

C# I need help to recode my code into two methods, If user is a member, next method should show the guessing game to get a gift if number is guessed. PLEASE!

//Determine loyalty discount eligibility Write(" Are you a member of our Futility Club, the frequent shopper program " + " \tthat rewards persistence over results? (\"Y\" if yes): "); loyaltyDiscount = ReadLine().ToUpper() == "Y" ? true : false;

sendGift = false; if (loyaltyDiscount) //Play the game!!! { WriteLine(" Excellent! Youll receive an AMAZING 15% discount on todays purchase!"); WriteLine("\tWhats more, as a valued member of our loyalty program, youll have a chance to win"); WriteLine("\ta bonus gift in our exciting Members-Only Invisible Paint Extravaganza contest! "); Write($"\tPick a number between {GameMin} and {GameMax}: ");

contestNumber = contestNumbers.Next(GameMin, GameMax + 1);

int.TryParse(ReadLine(), out guess); if (guess GameMax) { WriteLine($" \tThats not a number between {GameMin} and {GameMax}. What an ultra-maroon! \tStill, we value your loyalty."); } else { if (contestNumber == guess) { WriteLine($" \tWoo hoo! You guessed the secret number: {contestNumber}! " + " \tA gallon of ACME Invisible Paint is headed your way!"); sendGift = true; } else { WriteLine($" \tAww, too bad. You guessed {guess}, but the secret number was " + $"{contestNumber}. No paint. \tWhat a loser. Very sad."); } } } else { WriteLine(" \tWhats wrong with you? That just cost you a 15% discount and " + " \tan opportunity to win some Invisible Paint. Sad."); }image text in transcribed

bool LoyaltyDiscount() Interacts with the user to determine whether they belong to the Futility Club. Notes: Call from Main() Displays the script, asks the user whether they belong to the futility club, responds to their answer positively or negatively, and returns true if they belong, false if they do not. . . . bool EnterContest(Random chanceGenerator) Interacts with the users who belong to the Futility Club to determine whether they win a fabulous FREE GIFT! Notes: Call from Main() passing in the Random object initialized in Main(). Generate a random number for the user to guess. Interact with the user to get them to guess a number between 1 and 10. If the user wins, congratulate them. If the user loses, berate them mercilessly and tell them what the random number was. Return a bool: true if the user wins, false if they do not

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions