Page 1
Page 1
Started By
Message

Need help on C# problem

Posted on 3/2/15 at 2:45 pm
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22169 posts
Posted on 3/2/15 at 2:45 pm
Having some mental brick walls on this one for some reason.

Write a console application that will be used in a factories train loading facility to track the number of train cars filled, the total tonnage filled, and the average tons per train car. The program should repeatedly prompt the user for the following until they enter 0 for the first question:
Enter train weight in tons before loading (or zero to quit):
Enter train weight in tons after loading:
You should repeatedly ask these questions until the user enters 0 for the first question. When the user enters zero, output to the screen the total tonnage of product loaded unto the trains for the shift, the total number of train cards loaded, and the average weight in tons per train car. Also, check that the weight after loading is more than before (if not, ask the question over again until the user gets it right).
Posted by mikelbr
Baton Rouge
Member since Apr 2008
47507 posts
Posted on 3/2/15 at 3:01 pm to
quote:

Having some mental brick walls on this one for some reason.


what THEEE frick? google "sample console c# script for simple math operations and output"

Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22169 posts
Posted on 3/2/15 at 3:10 pm to
did you just add "google + subject + content" on me? shameful
Posted by moneyg
Member since Jun 2006
56546 posts
Posted on 3/2/15 at 3:12 pm to
quote:

Having some mental brick walls on this one for some reason.



What exactly are you asking?

What do you know how to do...and what do you not know how to do?
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22169 posts
Posted on 3/2/15 at 3:16 pm to
-I want to prompt for the 2 questions
-add variables to lists (while != 0)
-when first questions == 0, print out # of entries, after - before + number of entries, average of all

I'm not really good at loops

eta for code coming

for some reason it won't let me post the code on here.
This post was edited on 3/2/15 at 3:21 pm
Posted by MamouTiger65
Baton Rouge, La
Member since Oct 2007
794 posts
Posted on 3/2/15 at 3:24 pm to
The menu is a do-while loop.

The list of variables will either be an array or a linked list, whatever they are teaching you in the class.

Code is probably being blocked to prevent someone from injecting a script or sql. You can take a pic of your code and post that.
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22169 posts
Posted on 3/2/15 at 3:30 pm to


It's not very good but that is all I got right now

There are some //Comments to try out different parts and some variables that aren't used up at the top
This post was edited on 3/2/15 at 3:31 pm
Posted by MamouTiger65
Baton Rouge, La
Member since Oct 2007
794 posts
Posted on 3/2/15 at 3:40 pm to
All of your code to prompt the user, store the values and check that the weights are valid should be inside of your loop.

do
{
Prompt user
If( value <> 0)
{
store value
prompt for after weight
while(weight is invalid)
{
Prompt user for valid weight
}
}
else
{
Print out summary
}
}
while(value <> 0)
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22169 posts
Posted on 3/2/15 at 3:44 pm to
here is attempt 2 without finish
Posted by MamouTiger65
Baton Rouge, La
Member since Oct 2007
794 posts
Posted on 3/2/15 at 3:56 pm to
Review the logic in my post above. Just covert that into syntax and you have your app.
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22169 posts
Posted on 3/2/15 at 4:10 pm to
Thank you for your help. If it's not too much to ask, do you mind if I get your email address if I ever have questions about C#? I try to get them myself but sometimes I need help.
Posted by MamouTiger65
Baton Rouge, La
Member since Oct 2007
794 posts
Posted on 3/2/15 at 4:43 pm to
Just post on here. I probably check this site more than my email.
Posted by OldManRiver
Prairieville, LA
Member since Jan 2005
6925 posts
Posted on 3/2/15 at 7:23 pm to
I think one of your classmates already posted this

Seems Familiar
Posted by foshizzle
Washington DC metro
Member since Mar 2008
40599 posts
Posted on 3/2/15 at 7:32 pm to
quote:

I think one of your classmates already posted this


Nice find.

I knew this was far too simple for a real train facility. No consideration at all for persistent storage, for example. Plus in the real world I'd imagine a scanner would scan each car's id.
Posted by Hu_Flung_Pu
Central, LA
Member since Jan 2013
22169 posts
Posted on 3/2/15 at 8:44 pm to
hahahaha at least I got the first one without help
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram