Question: Can you please help me with the following assignment and code it in C + + exactly as it is shown? CS 1 3 5
Can you please help me with the following assignment and code it in Cexactly as it is shown? CS Assignment Finally the user should be prompted to what the current minecraft day is Remember, days
cannot be negative!
The program should be able to catch bad inputs and display an appropriate error message and
clase the program.
Determining the month:
The location and month affects the spawn rate of each crop separately. Because the program
only prompts the user for the total ingame days, we will need to calcul
Minecraft Steve needs your help!
Purpose:
The purpose of this assignment is to become comfortable integrating conditional
statements and decision making into Cprograms This allows programmers to
add depth and choice depending on conditions that are satisfied.
In this assignment, students will be able to implement Ccode that implements
the following
Interactive user input
Input error checking
Use of conditional statements to execute decision making
Use of switch statements to handle multiple cases
Premise:
Minecraft Steve needs your help! Steve is trying to program a device that can tell whether or not
a crop can be found given a biome location on a particular month, and display the rate of the
crop spawn. As someone playing on his server, he has asked you to help design a prototype with
the following conditions:
Input Handling:
The prototype will need to prompt the user for a valid biome and output an error message if a
valid biome is not provided.
The valid biomes include: Grasslands, Tundra, and Forest.
The user will enter GTor F respectively. The program IS NOT case sensitivemeaning you will
need to handle lowercase letter inputs: g t or f
Hint: We can either make our conditional statements to include cases or we can take
advantage of the toloweror toupperfunctions to change an uppercase letter to a lowercase
letter or vice versa.
tolowercharreturns the lowercase character
touppercharreturns the uppercase character
Afterwards, the user should be prompted to input the crop they are interested inAcceptable
inputs would be Ccand Ppfor carrots and pumpkins. Finally the user should be prompted to what the current minecraft day isRemember days
cannot be negative!
The program should be able to catch bad inputs and display an appropriate error message and
clase the program.
Determining the month:
The location and month affects the spawn rate of each crop separately. Because the program
only prompts the user for the total ingame days, we will need to calculate which month we are
currently on
Here are some assumptions we can make:
A minecraft year follows the traditional month cycle
A minecraft year contains only days making each month exactly days
Hint: With these assumptions, we can simply calculate the current month by taking the modulus
of the days with the number of days in a year. This will give us the leftover days in the current
year. Be careful as we have an extra case to consider as the last day of the year will be treated
as day We can create a special case to accommodate this.
Example formula:
Day Numberofdays daysinayear
Month roundDayDaysinamonth
From there, we can determine our current month by dividing the remaining days with the days in
a month and rounding up
Determining the rate:
Below is a table of the rates of both carrots and pumpkins. Note: Carrots can only be found in the tundra biome from the months July September
Example Output:
Good Input:
$aout
Please enter the current biome
t
Please enter the crop you wish to find
c
Please enter the current day in game
Carrots can currently be found at x rate
$aout
Please enter the current biome
Please enter the crop you wish to find
P
Please enter the current day in game
Pumpkins currently canno Example Output:
Good Input:
$aout
Please enter the current biome
t
Please enter the crop you wish to find
c
Please enter the current day in game
Carrots can currently be found at rate.
$aout
Please enter the current biome
Please enter the crop you wish to find
P
Please enter the current day in game
Pumpkins currently cannat be found.
Bad Input:
$aout
Please enter the current biome
P
Error: Biome cannot be found
$aout
Please enter the current biome
t
Please enter the crop you wish to find
Error: Crop does not exist
$aout
Please enter the current biome
Please enter the crop you wish to find
P
Please enter the current day in game
Error: Day cannot be negative be found.
Bad Input:
$aout
Please enter the current biome
P
Error: Biome cannot be found
$aout
Please enter the current biome
t
Please enter the crop you wish to find
Error: Crop does not exist
$aout
Please enter the current biome
Please enter the crop you wish to find
P
Please enter the current day in game
Error: Day cannot be negative
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
