Okay, so I'm taking MIS_271 (which is basically intro to C#) this summer at Washington State University and am more than half way through the 6-week super-condensed summer term. I was doing okay at first and have some experience with programming (mostly just VB and HTML) but then about 2 weeks ago my girlfriend's mother passed away. Well more specifically she was in the ICU for nearly 3 months battling an auto immune disease (Good Pasture Syndrome) before they opted to remove her from the ventilator. So as a result I haven't been able to make it to class for two weeks as I've been with my gf trying to console her etc.
I emailed my instructor but apparently she is unwilling to grant me any leeway in allowing me to turn in my assignment late. She basically told me to drop the class or find out some way to make my program work. And I reaaaally can't afford to drop this class, financially or academically, as I'm in line to graduate next summer with my MIS degree but only as long as I get good grades in all of my classes from now till then...
I think my main problem is that the book that we're using--"Head First C#"--eats a big stinky genitalia when it comes to explaining what she wants us to do, or what to do to begin with. Its more of a "do-it" book than a "reference" book and that totally throws me off. I've searched and searched and am having trouble understanding alotta' things that she wants us to do. The C# Station website has given me a fair amount of information but not being able to make it to class for the last two weeks has really put me at a disadvantage. And I'm getting really frustrated. I'm hoping that one of you guys (or gals) could help me out with this assignment because its due tomorrow (Monday June 7) @ 5:59pm pacific time and I basically don't know what the F I'm doing.
The assignment is:
Now I know that alot of this is prolly' wrong but any help would be super appreciated. Like did I do anything right? I just got really stuck when it came to #5, and have no idea how to accomplish the event-handler requirements...
And here's what I have for Form1.cs (and I know alot of it is incorrect/incomplete):
And for the "new" class calculate.cs that I created:
I emailed my instructor but apparently she is unwilling to grant me any leeway in allowing me to turn in my assignment late. She basically told me to drop the class or find out some way to make my program work. And I reaaaally can't afford to drop this class, financially or academically, as I'm in line to graduate next summer with my MIS degree but only as long as I get good grades in all of my classes from now till then...
I think my main problem is that the book that we're using--"Head First C#"--eats a big stinky genitalia when it comes to explaining what she wants us to do, or what to do to begin with. Its more of a "do-it" book than a "reference" book and that totally throws me off. I've searched and searched and am having trouble understanding alotta' things that she wants us to do. The C# Station website has given me a fair amount of information but not being able to make it to class for the last two weeks has really put me at a disadvantage. And I'm getting really frustrated. I'm hoping that one of you guys (or gals) could help me out with this assignment because its due tomorrow (Monday June 7) @ 5:59pm pacific time and I basically don't know what the F I'm doing.
The assignment is:For this assignment you will create an application starting with the following form:
This application will calculate the area of 2 rectangles. The first rectangle will have the are corresponding to the dimensions the user selects in the numericDropDown boxes (width and length). The second rectangle will have the area corresponding to a rectangle that has the double of the width that the user selected (but same length selected by the user).
1. Create a new project and create form according to figure above (or at least with the same controls.
2. Create a new public class which will be responsible to offer a method that calculates the rectangle area.
3. Create a public non-static method in the new class that will require two numeric values passed to it (i.e. the measurements of the width and of the length) and returns the resulting area. Of course, this method will have the calculation statement.
4. Create an event-handler for the calculate button in the form.
5. In the event-handler
o read the 2 values selected by the user into two different variables.
o Create 2 instances of the new class; so, two objects --> one will hold the small area result, the other will hold the large area result.
o The first object should call the new class' method passing to it the values selected by the user (which should now be held in two variables) and assign the result to a variable that will store the small area.
o The second object should call the new class' method passing to it the values selected by the user with the width value, however, doubled, and assign the result to a variable that will store the large area.
o Both results should be displayed back into the specific read-only textboxes
Now I know that alot of this is prolly' wrong but any help would be super appreciated. Like did I do anything right? I just got really stuck when it came to #5, and have no idea how to accomplish the event-handler requirements...
And here's what I have for Form1.cs (and I know alot of it is incorrect/incomplete):
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int width;
int length;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
width = (int)widthNumericUpDown.Value;
length = (int)LengthNumericUpDown.Value;
Calculate smallArea = new Calculate();
Calculate largeArea = new Calculate();
}
}
}
And for the "new" class calculate.cs that I created:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class Calculate
{
public int calculateArea(int widthNumericUpDown, int lengthNumericUpDown)
{
int width = widthNumericUpDown;
int length = lengthNumericUpDown;
int result = width * length;
return result;
}
}
}
