[Solved] CSE 102 Homework 3

$25

File Name: CSE_102_Homework_3.zip
File Size: 169.56 KB

SKU: [Solved] CSE 102 –Homework 3 Category: Tag:
5/5 - (1 vote)

DEPARTMENT OF COMPUTER ENGINEERINGCSE102 HW03In this homework, you are going to implement a program which contains several sub-programs.Function: void menu()This is a menu function. User enters a choice to execute corresponding sub-program. When 0 is chosen, the program stops. Whenever a sub-program is finished, your program goes back to menu so that user can execute another sub-program. You are going to use do-while loop and switch case to implement this function.The user will have four different choices, i.e., {1, 2, 3 or 0}. Any other input will be invalid, and program must display menu again when a wrong input is entered.Sample output if this function is:1. Horse Racing Game2. Occurrence Counter3. Triangle of Sequences0. ExitFunction: int getInt(int mini, int maxi)It gets an integer input value from user. It checks if the entery is within the operands [mini,maxi] (including the borders). If the entry is not within the range, function requests another input from the user. This continues untill the right input within range is entered.Function: int numberGeneratorBetweenRange(int min, int max)This program generates a number between min and max values, including them. The number generator should sample uniformly within this range.Function: void horseRacingGame()In this game (sub-program), you are going to implement a virtual horse race. You must generate number of horses randomly between 3 and 5. Each horse runs the course within a randomly generated time between 10 and 20 units. The fastest horse (least race time) wins the race. There are no case of tie. If your horse is the only fastest horse or one of the fastest horse, you win. Otherwise, you lose (even there are more than one fastest horse except yours).At the end of the race, you should output the total number of horse, your horse number, race time of each horse and the result of the race. Sample outputs are provided below.Example Outputs:Number of Horse: 5Horse Number: 3Racing startsHorse 1: Horse 2: -Horse 3: Horse 4: -Horse 5: You win! Winner is Horse 3.Number of Horse: 4Horse Number: 2Racing startsHorse 1: Horse 2: Horse 3: Horse 4: You lose! Winner is Horse 1 (or 4. It does not matter.).Number of Horse: 3Horse Number: 3Racing startsHorse 1: Horse 2: Horse 3: You win! Winner is Horse 3.GEBZE TECHNICAL UNIVERSITYDEPARTMENT OF COMPUTER ENGINEERINGFunction: void countOccurrence()This sub-program asks for two positive integer values from the user. These two values arebigNumber and searchNumber. This sub-program computes number of occurrences ofsearchNumber in bigNumber.Sample Outputs:Big Number: 111Search Number: 11Occurrence: 2Big Number: 209480948Search Number: 7Occurrence: 0Big Number: 1231231Search Number: 1Occurrence: 3Function: void triangleOfSequences()This sub-program generates a random integer value between 2 and 10. It then generates a triangle ofsequences as illustrated below.Output (for 6):12 43 6 94 8 12 165 10 15 20 256 12 18 24 30 36

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE 102 Homework 3
$25