Maximum PC

It is currently Sat Apr 25, 2015 6:57 am

All times are UTC - 8 hours

Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: My C# Homework
PostPosted: Thu Jan 22, 2009 2:07 pm 

Joined: Fri Jun 20, 2008 1:55 am
Posts: 2
I want to start out by saying that I am a Chem major, but I am taking this class to broaden my computer skills. It is my first week of class and I am totaly lost, so I wanted to see if anyone might be able to help me finish this program. I dont by any means want you anyone to do it for me, yet just to help me learn how to finish what I started. here is the code i have so far

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
class Program
static void Main(string[] args)
string sName;
int iTest1, iTest2, iTest3;
int iTotPts;
double dPct;
Console.Write("__prompt fr 1st__");
Console.WriteLine("Welcome To My Bomb Grade Estimator Program");
Console.WriteLine("Summary of Scores");
Console.WriteLine("Your Score so Far is: "+dPct.ToString("P1");//
iTotPts+= 150;


I have bugs on line 17/26/32/32/17

This is what I am trying to do
Project One is a console based application. The application is designed to provide grade information for students in a class where the grade is determined by scores on 4 tests with 150 points possible on each test. For this application we are assuming that 3 tests have already been given. The application prompts the user for his/her name and scores for the first 3 exams. The application then computes the students total points earned and percentage score based on these exams. Finally, the application computes the total points and percent score for the course that the student could earn with a perfect score on the last exam. The application displays a greeting to the student and summary information about their performance to date and their potential performance with a perfect final exam score (see the example program output below).

Any help would be great


 Post subject:
PostPosted: Thu Jan 22, 2009 4:40 pm 
Little Foot
Little Foot
User avatar

Joined: Mon Jul 28, 2008 1:39 pm
Posts: 123
OK... the first problem:

string sName;
sName = int.Parse(Console.ReadLine());

can you figure out why this won't work?
If you're really stuck, the answer is below, just highlight it.

sName is a string, but int.Parse() returns an int. The call to int.Parse() is unnecessary; just say sName = Console.ReadLine().

 Post subject:
PostPosted: Tue Apr 28, 2009 8:11 pm 
Little Foot
Little Foot

Joined: Sat Feb 11, 2006 11:04 am
Posts: 174
sName = int.Parse(Console.ReadLine());

You declared sName as a "string" type. int.Parse changes a string into an integer. Since you are changing the input of the user as an integer and assigning an integer to a string it is incorrect. What you want is

sName = Console.ReadLine();

Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 8 hours

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.