473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

I don't understand this

I'm trying to follow along in class typing exactly whats put on the board.

using System;

namespace SchoolStuff

{
public class UseCalcPay

{

public static void Main()

{

double myHours = 37.5;

double myRate = 12.75;

double grossPay;

grosspPay = CalcPay(myHours, myRate);

Console.WriteLine("My gross pay is{0}", grossPay.ToString("C"));

}

public static double CalcPay(double hours, double rate)

{

double gross;

gross = hours * rate;

return gross;

}

}

}

And when I try to compile, it saysit can't find the name grossPay

Then, on this

using System;

namespace SchoolStuff

{
public class UseSevenPercentSalesTax

{

public static void Main()

{

double myPurchase = 10.99;

ComputeSevenPercentSalesTax(myPurchase);

ComputeSevenPercentSalesTax(35.67);

{

double tax;

tax = SaleAmount * 0.07;

Console.WriteLine("The tax on {0} is {1}", SaleAmount, tax.ToString("f"));

}

}

}

it's expecting a brace but I dn't know where

Lastly on this example

using System;

namespace SchoolStuff

{
public class UseSalesTax

{

public static void Main()

{

double myPurchase = 239.11;

double myRate = 0.10;

ComputeSalesTax(myPurchase, myRate);

ComputeSalesTax(16.55, 0.02);

}

public static ComputeSalesTax(double saleAmount, double taxRate)

{

double tax;

tax = saleAmount * taxRate;

Console.WriteLine("The tax on {0} is {1}", saleAmount, tax.ToString("F"));

}

}

}

it says it has to return a type.

I asked the teacher but he's like..oh yeah..fjkslf mumble mumble mumble
seriously, he can't answer...I'm not even sure he knows very much about C#
because he didn't know what a name space is and it seems as if he's just
reading the book one chapter ahead or something.

Please help if you can.
Nov 15 '05 #1
4 1587
Robert,
grosspPay = CalcPay(myHours, myRate); And when I try to compile, it saysit can't find the name
grossPay
Look closely. It can't find grosspPay (note the extra "p"). Change
it to grossPay and it will work.

Then, on this

using System;

namespace SchoolStuff
{
public class UseSevenPercentSalesTax
{
public static void Main()
{
double myPurchase = 10.99;
ComputeSevenPercentSalesTax(myPurchase);
ComputeSevenPercentSalesTax(35.67); { // *** Delete this brace. *** double tax;
tax = SaleAmount * 0.07;
Console.WriteLine("The tax on {0} is {1}", SaleAmount,
tax.ToString("f"));
}
}
}

it's expecting a brace but I dn't know where
<snipped> it says it has to return a type.

I asked the teacher but he's like..oh yeah..fjkslf mumble mumble
mumble seriously, he can't answer...I'm not even sure he knows
very much about C# because he didn't know what a name space is
and it seems as if he's just reading the book one chapter ahead
or something.


Change this:

public static ComputeSalesTax(double saleAmount, double taxRate)

to this:

public static double ComputeSalesTax(double saleAmount, double
taxRate)
On a side note...

If possible, please try to use something other than Outlook Express
to post messages containing code. Outlook really mangles the code,
which makes it hard to read.

Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 15 '05 #2
"Robert Blackwell" <robbieatwowcentraldotcom> wrote in message news:uE*************@tk2msftngp13.phx.gbl...
I'm trying to follow along in class typing exactly whats put on the board.

using System;

namespace SchoolStuff

{


public class UseCalcPay

{

public static void Main()

{

double myHours = 37.5;

double myRate = 12.75;

double grossPay;

grosspPay = CalcPay(myHours, myRate); /* Here is the problem grosspPay should be grossPay */

Console.WriteLine("My gross pay is{0}", grossPay.ToString("C"));

}

public static double CalcPay(double hours, double rate)

{

double gross;

gross = hours * rate;

return gross;

}

}

}

And when I try to compile, it saysit can't find the name grossPay

Then, on this



using System;

namespace SchoolStuff

{


public class UseSevenPercentSalesTax

{

public static void Main()

{

double myPurchase = 10.99;

ComputeSevenPercentSalesTax(myPurchase); /* Here I presume that you are trying to invoke ComputeSevenPercentSalesTax function, but where is this function declared ?? */

ComputeSevenPercentSalesTax(35.67);

{

double tax;

tax = SaleAmount * 0.07;

Console.WriteLine("The tax on {0} is {1}", SaleAmount, tax.ToString("f"));

}

}

}



it's expecting a brace but I dn't know where



Lastly on this example

using System;

namespace SchoolStuff

{


public class UseSalesTax

{

public static void Main()

{

double myPurchase = 239.11;

double myRate = 0.10;

ComputeSalesTax(myPurchase, myRate);

ComputeSalesTax(16.55, 0.02);

}

public static void ComputeSalesTax(double saleAmount, double taxRate) /*Here you are missing return type */

{

double tax;

tax = saleAmount * taxRate;

Console.WriteLine("The tax on {0} is {1}", saleAmount, tax.ToString("F"));
}

}

it says it has to return a type.

I asked the teacher but he's like..oh yeah..fjkslf mumble mumble mumble
seriously, he can't answer...I'm not even sure he knows very much about C#
because he didn't know what a name space is and it seems as if he's just
reading the book one chapter ahead or something.

Please help if you can.

Nov 15 '05 #3
Sorry about the code pasting...normally I past from VS into my chat client or a web based text box, then cut and past into here and it's normal text etc.

Thanks helping me out. I beat myself up mentally when I can't find what
s wrong...I don't think I would have caught the extra p.
ComputeSevenPercentSalesTax(myPurchase);

/* Here I presume that you are trying to invoke ComputeSevenPercentSalesTax function, but where is this function declared ?? */

That's what I was thinking...unless I missed it, I don't think he even got to that part.
But actually, that's probably why I had that lone brace there...cause I was gonna put that function before it or something.
PS. How did you guys learn to program? Through a course at school, or self taught with books and or help from friends.

The teacher mumbles a lot and often doesn't complete his sentances and it seems as if he's only a chapter or so ahead of the class cause he couldn't asnwer many of the questions that other classmates asked.

I was assuming that the teacher would be an "experienced" professional or something; being that this is a college course. Is that the way a lot of beginner programming classes are?
Nov 15 '05 #4
"Robert Blackwell" <robbieatwowcentraldotcom> wrote in
news:ea**************@TK2MSFTNGP11.phx.gbl:
PS. How did you guys learn to program? Through a course at
school, or self taught with books and or help from friends.
Robert,

I'm largely self-taught, and prefer to learn from books rather than
taking classes. I think both ways are good ways to learn, so long as
the learning resources (teachers and books) are of high quality.
The teacher mumbles a lot and often doesn't complete his
sentances and it seems as if he's only a chapter or so ahead of
the class cause he couldn't asnwer many of the questions that
other classmates asked.

I was assuming that the teacher would be an "experienced"
professional or something; being that this is a college course.
Is that the way a lot of beginner programming classes are?


I don't think (hope?) the situation you're in is the norm. But I
have been in exactly the same situation before. My solution was to
get an introductory text and teach myself.

That happened to me before the world wide web had been invented.
Today, you can just surf the web and get introductory material on C#:

http://www.codeguru.com/csharp/
http://www.c-sharpcorner.com/
http://www.csharphelp.com/
http://www.csharp-station.com/Tutorial.aspx
http://www.aewnet.com/root/dotnet/cs...harptutorials/
http://www.hitmill.com/programming/d...html#tutorials

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bart | last post by:
Hi all I don't understand globals between multiple modules in a python program. I really don't. I've narrowed it down to the following two very simple programs a.py and b.py. When I run a.py I...
40
by: komone | last post by:
"Now is the time for all good web developers to use stylesheets". Hmm OK, so I start this commercial site design with the express intent of using CSS entirely. (Something I haven't attempted in...
7
by: Robert Nicholson | last post by:
So I've got one page where I have an image inside a DIV with text-align: center and the image is correctly centered in that block. Making me think that text-align will center the contents of a...
3
by: Lars | last post by:
Hello I write all my applications in VB6-- and I don't understand the reason to move to .NET (other than MS might break VB6 apps in future updates). I'm taking the position that I don't...
20
by: Sam | last post by:
Hi I'm learning to code with C++ and wrote some very simple code. I think it's consistent with every rule but always got compiling errors that I don't understand. The code include 5 files as...
16
by: Jace Benson | last post by:
Ok I have read alot of things on zend.com, php.net and other sites went to the wikibooks to try to understand how to use a class. I have this project I want to do that I am sure would work great...
31
by: Jo | last post by:
class A { public: char text_a; A() { *text_a=0; } ~A() {} }; //-----------------------------------------------------------------------------
21
by: jehugaleahsa | last post by:
Hello: I had an hour-long discussion with my boss today. Last night, right before I dozed off, I realized some of his code resulted in duplicate processing. I tried to explain it to him and he...
3
by: Ben Thomas | last post by:
Hello, I have the following code which I don't understand why it works : #include <iostream> using namespace std; void DontWork (unsigned int& i) { cout << i << endl; }
2
by: None | last post by:
Hi All These code are part of Prototype. There are something that I don't understand, would you please explain it for me? ....... toJSON: function(object) { var type = typeof object; switch...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.