//Program.cs using System; namespace Midterm { /// <summary> /// Midterm - compl
ID: 3657405 • Letter: #
Question
//Program.cs
using System;
namespace Midterm
{
/// <summary>
/// Midterm - complete the missing pieces.
/// The program displays information for two players.
/// </summary>
class Program
{
/// <summary>
/// Required Main method to begin the application.
/// </summary>
static void Main()
{
// Replace John Doe with your name in the line below:
Console.WriteLine("CS 201 Midterm - John Doe ");
// player1 has been created using the default constructor
Player player1 = new Player();
// set player1 properties (his name is Arlo, he's male, his
// lot is 150' x 180', and he earned 250 gold coins this year):
// create a second player using a non-default constructor
// of your choice so that her name is Betty, she's female,
// she's a farmer,
// her lot is the standard 100' x 130',
// and she earned the standard 234 gold pieces.
// Call the method below to display results for Arlo:
// Call it again to display the results for Betty:
// Increase the number of gold coins Arlo has by 25:
// Increase the number of gold coins Betty has by 25:
// Redisplay the full set of results for each player:
// Write a command that will keep the console open
// so you can check your results. Copy them into your
}
// Modify the display results method to accept a player argument.
static void DisplayResults()
{
// Add statements to create a complete set of output
// for one player as shown below - make sure the formatting matches
// the first set of results for Arlo as shown below.
}
}
}
// Replace the following with your complete output:
// (not all answers have been included) :-)
/*
CS 201 Midterm - John Doe
The player's name is: Arlo
The player's wages are: $25,000
The player's tax due is: $1,750.00
The player's surcharge is: $2,700.00
The player's gender is: M
The player's lot size is: 27,000.0
The player's name is: Betty
The player's wages are: $23,400
The player's tax due is:
The player's surcharge is:
The player's gender is:
The player's lot size is:
The player's name is: Arlo
The player's wages are: $27,500
The player's tax due is:
The player's surcharge is:
The player's gender is:
The player's lot size is:
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////
//Player.cs
using System;
namespace Midterm
{
/// <summary>
/// Midterm - code the player class as described below.
/// </summary>
class Player
{
// Private Variables - create 6 variables to hold:
// the player's name
// the player's gender (either M or F - default to F)
// the width of the player's homestead lot in ft (default to 100)
// the length of the player's homestead lot in ft (default to 130)
// the annual number of gold coins the player earns in a year (default to 234 & use an integer)
// is this player a farmer? (e.g. isFarmer) default to yes - the player is a farmer
// Define 3 private constant class variables:
// Define the current value of a gold coin to be equal to 100 dollars.
// Define the king's tax rate to be 7% of annual income.
// Define a land surcharge to be 10 cents per square foot.
// Public Properties - create 6 public properties
// Use accessors & mutators to allow all 6 properties to be retrieved and modified.
// Create a seventh public property (read-only!) to provide the annual wages in dollars:
// Constructors - the default constructor has been created for you.
// Create 2 additional constructors:
// One with just the name supplied
// One with all inputs supplied
public Player()
{
}
// Method 1:
// Create a method to calculate the king's tax in dollars given the integer number of coins.
// Call the method KingsTaxOwed and return a double.
// Since doing it this way won't require any instance variables, make it a class method.
// Method 2:
// Create a method to calculate land surcharge in dollars without using any arguments.
// Call the method SurchargeAssessed and return a double.
}
}