DeskGUI For Programming in C# I\'m a visual person so can I see pictures of the
ID: 3684751 • Letter: D
Question
DeskGUI
For Programming in C# I'm a visual person so can I see pictures of the assignment how it should look with the code together?
Basic Steps in Creating your Program
Create your user interface (GUI). Use different font styles but don’t overdo it, Use colors, and Use graphics (You can find all kinds of graphics for the images pizzas). Add the controls you will use for your program. You could use picture boxes, buttons, labels, combo box, radio buttons, option box and any other controls that might help in the presentation of GUI. The book has an example of what the GUI could look like, but be creative and make your own GUI.
Set the names of all controls. (for example, if you have a list box or label it could be txtNumber). Follow the naming convention (camel casing) for naming controls.
Now you are ready to write the code that will be executed by events at run time. You will probably have a button or other picture box control that you will click on at runtime. Double Click it and you will be taken to the code window where you can write code inside of the control code event handler.
Run and debug your program, making sure all parts work correctly. Consider data validation for the input information. As you advance to more complicated programs you will be given various ideas on validating input.
Remember to document your code with comments included in your code statements in the code window.
Your program assignment
Write a program name DeskGUI that computes the price of a desk and whose button Click Event calls the following methods:
A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to the SelectDesk_Click event.
A method to accept an input and return the type of wood, m for mahogany, o for oak, or p for pine.
A method that accepts the number of drawers and wood type and calculates the cost of the desk based on the following
Pine desks are $100
Oak desks are $140
All other woods are $180
A $30 surcharge is added for each drawer.
This method returns the cost to the SelectDesk_Click event.
A method to display all the details and final price.
All methods are void methods and receive ref or out parameters as appropriate.
Explanation / Answer
using System;
public class ComputePriceDesk
{
public static void Main()
{
double calc = usersDrawers();
Console.WriteLine ("The total of your desk is $ {0}", calc);
}
public static double usersDrawers()
{
int New;
string HowManyDrawers = "";
Console.Write("How many drawers would you like in your desk?: ");
HowManyDrawers = Console.ReadLine();
New = Convert.ToInt32(HowManyDrawers);
return New;
}
public static int woodType()
{
string woodType;
char charWoodType;
Console.WriteLine ("What type of Wood will your desk be? ");
Console.WriteLine ("m for mahogony");
Console.WriteLine ("o for oak");
Console.WriteLine ("p for pine");
woodType = Console.ReadLine();
charWoodType = Convert.ToChar(woodType);
return 0;
}
public static int usersWood()
{
const int moh = 180;
const int oak = 140;
const int pine = 100;
int wood;
if (woodType == 'm' || woodType == 'm')
wood = moh;
else if (woodType == 'o' || woodType == 'O');
wood = oak;
else
wood = pine;
return wood;
}
public static void calculations(int, char)
{
int totalDrawers;
char wood;
int calc;
calc = totalDrawers * wood;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.