Grading Program - Having a hard time
Hi, I am making a grading program for my intro java class. We are required to make our own class and then use a "driver" class to test our template. The problem I am running into is that I do not know why some variables are being returned while others are not.
In the program, we are to create a class that gets the student id/quiz1 score, quiz2, midterm, and final. The grades are weighted. I will paste the StudentRecord class, the DriverStudentRecord, and then a sample output. Please help. I have been banging my head into this book but nothing is jumping out at me on how to fix it. Thanks!
StudentRecord
import java.util.*;
public class StudentRecord {
private int studentID, quizOne, quizTwo, midTerm, finalExam, overallScore,
quizTotal;
private char letterGrade;
public void readInput()
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter the Student's ID#: ");
studentID = keyboard.nextInt();
System.out.println("Please enter the score for Quiz 1: ");
quizOne = keyboard.nextInt();
System.out.println("Please enter the score for Quiz 2: ");
quizTwo = keyboard.nextInt();
System.out.println("Please enter the score for the Midterm: ");
midTerm = keyboard.nextInt();
System.out.println("Please enter the score for the Final Exam: ");
finalExam = keyboard.nextInt();
public void calculation()
quizTotal = quizOne + quizTwo;
quizTotal = quizTotal * (25/100);
midTerm = midTerm * (25/100);
finalExam = finalExam * (50/100);
overallScore = quizTotal + midTerm + finalExam;
public char letterGrade()
if (overallScore >= 90)
return 'A';
else if ((overallScore >= 80) && (overallScore < 90))
return 'B';
else if ((overallScore >= 70) && (overallScore < 80))
return 'C';
else if ((overallScore >= 60) && (overallScore < 70))
return 'D';
else if ((overallScore >= 0) && (overallScore < 60))
return 'F';
else
return 'Z';
public void writeOutput()
System.out.println("Student# " + studentID + " grade report");
System.out.println("Quiz one = " + quizOne);
System.out.println("Quiz two = " + quizTwo);
System.out.println("Quiz totals = " + quizTotal);
System.out.println("Midterm = " + midTerm);
System.out.println("Final = " + finalExam);
System.out.println("Overall Score = " + overallScore);
System.out.println("Final Letter Grade = " );
}DriverStudentRecord
public class DriverStudentRecord {
public static void main(String[] args) {
StudentRecord testStudent = new StudentRecord();
testStudent.readInput();
testStudent.calculation();
testStudent.letterGrade();
testStudent.writeOutput();
}& Sample output
Please enter the Student's ID#:
999
Please enter the score for Quiz 1:
10
Please enter the score for Quiz 2:
8
Please enter the score for the Midterm:
90
Please enter the score for the Final Exam:
70
Student# 999 grade report
Quiz one = 10
Quiz two = 8
Quiz totals = 0
Midterm = 0
Final = 0
Overall Score = 0
Final Letter Grade =
Why are only quiz1 and 2 responses being carried over, but the rest are not? Does this look okay so far? I have never written my own class like this. Lastly, how do I get the letterGrade to print its return value? Thanks all! I really do appreciate it.
I went through uni with a chineese bloke, apparently
if you get less than 50% for anything (once) they
kick you out of school and make you a farmer. Tough
call on a six year old.
eristic,
I know you're learning, and you appear to be making
good progress, so feel free to ignore this small
criticism... your readInput and writeOutput methods
would be better placing in your driver class. Apart
from thay you're coming along fine.
1)
... do not alter thevalues of your quizes, midterm,and final.
Use the weights (25, 50, etc) in your finalcalculation only.
I think pete means (but I can't talk for him)
something like : public void calculation()
score = (quiz1+quiz2)/4.0 + midTerm/4.0 +
finalExam/2.0;
}) You forgot something on this line:
System.out.println("Final Letter Grade = " );
test it... work out a bunch (6 should do) students
scores by hand, or with a calculator, or use excel...
and then run them through your program. Are the
answers what you expected?I was under the impression that the DriverStudentRecord is just a title for a test class? Instead of saying test, the prof. said Driver. Does driver mean something more than that? Also, I'm just following the structure that I've seen in my book so far. What advantage/benefit is there for putting those 2 in the driver? (that way I can understand why they are better suited there).
Similar Messages
-
I'm trying to install a Citrix XenApp for work purposes and am having a hard time. The message "The installer has insufficient priveleges to this directory: C:\Program Files (x86) \Mozilla Firefox \Plugins \resource. The installation cannot continue. Log on as administrator or contact your system administrator." I am using a Toshiba Satellite laptop and am the only user and administrator as well. I have read other Firefox support articles and google answers but nothing has resolved this issue. Please help! Be detailed and visual if possible
There are no BIOS settings, because Macs don't have a BIOS. I don't use Parallels, but I assume it has simulated BIOS settings. You'd have to consult its documentation to find out how to change them.
-
I have a PC DVR Net card and having a hard time connecti...
I have a PC DVR Net card and having a hard time connecting to the media server from my friends computer.I have read everything I can about port forwarding and I believe everything is right but I can't connect to my Web Cam server from another location. I do have it working on my Lan but when I go to a friends computer I can download the Web Cam fine but when I try to start the server it say's can't connect.My router is a WRT54G Version 3. I forward the Ports to the ports I was suppose to and I even made the computer a static Ip on it and everything seem's to work but I can't get into the server from another PC outside of my connection. My windows XP firewall is turned off and I even turned off the firewall on the router but still no luck. I hooked my connection up right to the computer bypassing the router and I was able to connect to my camera server from my friends computer with no problem so I know it's the router itself causing the problem..I used this one program to check and see if the ports were open and it said they were so I'm lost at this point. Any suggestions I would appreciate it very much.
Thank'sReset the router for few seconds ...
Disable all the firewall on the computer ...
Check the IOp ... if getting Ip - 192.168.1.X .... try to ping the Ip .... If getting replies ... try going online
If not gettting Ip -- assign static Ip ... repeat the step ...
Still no luck ..possible the router is gone bad .... -
I have lost my iCal data and am having a hard time retrieving it from Time Capsule. I am using Mountain Lion OS om iMac. Can anyone help?
You cannot see it because it is hidden.. one of those great things apple does.. if it is hidden in your Mac then it will be hidden in the Time Machine Backup.
You will need to restore the entire folder to a different location.. and unhide it.
There is some info here about restoring particular files or folders.
http://pondini.org/TM/16.html
And some info from Lion which should also relate to Mountain Lion.
https://discussions.apple.com/thread/3231381?start=0&tstart=0
There is stuff about recovery near the end.
One wonders sometimes when Apple make these decisions if they ever think about what happens when something goes wrong. Hiding files..??? -
Having a hard time signing into websites with Safari
Hi, I'm having a hard time signing in my username and password for e-mail addresses I use and for message boards as well. I use Safari all the time accept for my school website that requires IE. Anyways, I use Comcast and I have been trying to sign into my e-mail address name and everyime I click "sign in mail" Safari says "Safari Can't Open Page". So then, I went to my AIM mail to sign in there and then it said the same thing. Then I went to this Apple Forum to ask if anyone knows what the problem is, and then when I went to sign into here, the same thing. So right now I am using Camino, but can anyone help me with this problem or is anyone having the same problem as me? Thanks.
I too have been having a problem of logging into certain websites with a username and password. Instead of logging in successfully with Safari, a blank page or an error would occur.
This happened for: citibank, comcast, sprint, and miscellaneous other sites.
This problem apparently had something to do with my cookies since erasing my cookies seemed to solve the problem. Here's how to do it:
Safari -> Preferences...-> Security -> Show Cookies -> Remove All.
Keywords: login error failure log in log-in unable to trouble
iBook G4 Mac OS X (10.4.7) 800 Mhz / 640 mb -
Having a hard time with burning photos onto a CD...
Whew! I just found the photos I thought I had deleted this morning, they're in my Finder, inside the iPhoto Library. Now I'm having a hard time trying to burn them onto a CD. The size is 232 MB and my MacBook is OSX Lepard. Would you tell me how to do it step by step? I'm not good at this stuff. Thank you in advance for your help.
It is simple......
http://www.ehow.com/how_6225993_burn-photos-cd-mac.html -
I'm having a hard time with Adobe CS6 synching up with my soundcard. Latency settings and other applications are challenging at this time. I had 3.0, but my Windows 7 computer is now "deceased". Please help.
I endorse everything that Steve just said but to try and get you going while you're shopping for an audio interface more suitable for sound work than use as a doorstop, try the following:
Go to the Windows sound control panel and make sure the SB card is selected as the default on both the Recording and Playback tabs. On the advanced menu for both, set the bit depth and sample rate to either 16/44,100 (CD) or 16/48,000 (Video) depending what suits you best. Note that your SB card only works natively at 16/48,000 so anything else involves a conversion that the card hides from you.
Go to the Windows Control panel and, under the sound section, turn off all system sounds (since they can hijack your sound card). Close every other application that may want to use the sound card (internet for example).
In Audition, go to Edit/Preferences/Audio Hardware. Set the device class to MME. On the drop down menus set the Default Input and Default Output to be your Soundblaster. On the Master Clock set it for the SB Output (this'll likely be default). Set the latency at around 200ms (you may need to increase this later if your playback stutters--or you can try decreasing it until you get stutter, then take it back up a bit. Set the sample rate to whatever you selected on the Windows Sound Control Panel.
The Soundblaster will likely have installed it's own control menu. Go to this and select Mic or Line as appropriate for the input and whatever you need for the output. I can't be more specific as SB keep changing what they call things.
Hopefully this'll get you going even if it's not the best compromise for quality and latency. -
I have a macbook pro with 250 GB of Space, 2.2 Processor, 16 GB of Memory 1600MHz, and Intel Iris Pro 1536. I backed up my apps using iTunes but I am having a hard time restoring my apps back to my iPhone 5s so could you please help me?
So did you ever get your apps back on your iPhone?
-
I am having a hard time with my fcp x running so slow. i can't even move my mouse without the time wheel coming on and staying up for at least 20 some seconds. I have upgraded my ram to 12 and changed all my files to proxy files; also i cleaned the crap out of my computer removing all other media files I didn't need and it is still running the same. Please help! I have a deadline on my short film to be submitted and I can't finish it like this. Oh also it ran fine in the beginning but and one day it just started doing this out of no where. Anything will help! Thanks
In addition have you got FileVault switched on as that will kill performance.
-
I authorized a second computer on my iTunes account and tried to get my first computer's library on my second computer via the Cloud. Many of the songs only partially downloaded, and I am having a hard time getting rid of the library with the partial downloads (so I can get full songs). I am considering nuking the current iTunes on the second computer and re-installing, giving myself a clean slate to work with. Is this the right way to go?
How to use your iPod to move your music to a new computer
-
Hi, I have a power Mac G5 with an airport card, MAc OS X 10.5.8, Wireless card is Airport Extreme ( 0x14E4,0x4E ) and I am having a hard time connecting to my regular NETGEAR router. PLS Help,
Thanks,
MishcadolaI spent 2750 $ for my 24" iMac (price for my region)...
And the perfect world of Steve Jobs still close, but never we've been in there! -
I want to take my debit card information off of my itunes account i have a iphone 4 im having a hard time?? does anyone know how to put none for the billing information
http://support.apple.com/kb/ht2534
-
I am having a hard time trying to set up my cc info on iTunes. I keep getting a message that says invalid security code which is on the back of my card and the same card I use to make purchases online with all the time. What may be the problem?
iTunes Store: My credit card's security code or zip code does not match my bank's records
http://support.apple.com/kb/TS1646 -
Having a hard time lining up the audio to the video with FCPX.
Hi there
I'm having a hard time lining up the audio to the video with FCPX.
I'll just advise what I am doing.
I have recorded video of me playing bass guitar along to a song.
I have recorded the video in 720p with a DSLR.
I have recorded the bass guitar audio directly into Garageband (Using a USB interface) on a separate track to the song that I am playing along to. (It is played very well and is not out of time to the original)
I then mix the original song and the new bass guitar audio played by myself and export as an AIF in Garageband.
I import the video from the DSLR and AIF audio into Final Cut Pro X (10.0.5)
I can get the audio and video NEARLY bang on to timing, but its still ever so slightly off. As its ever so ever so slightly off it looks like I'm not really playing the bass guitar myself.
I'm moving the audio intricately but I just cant seem to get it lined up EXACTLY.
My camera picked up a tiny bit of audio so I can hear and see the audio wav on the video track to try and line it up with the audio wav of the AIF, but no matter what I just cant get it to line up and look exactly right.
Can anyone offer any advise or tips?
ThanksMake sure you have Snapping switched off.
Expand the timeline to see the detail.
Rather than lining it up manually you could try the Automatic Audio Synch if there is any audio on the original video. -
Having a hard time selecting an iWeb website host
Now that MobileMe is gone and my website is down (yes, i missed the memo)... im researching hosts and having a hard time choosing.
I would like unlimited storage as I have a lot of photos on my site.
RAGE sounds good but seems pricey.
I'm looking for a company familiar w/iWeb so that if there are any issues I have some assistance.
I have searched the community and googled and keep getting just a few answers. Nothing that really gives me a solid sense about the companies. And it seems that RAGE does a lot of self promotion posing as customer which seems a bit sketchy. I might be completely wrong but thats the sense Im getting from the videos and results I'm finding.
Is there a site that gives solid reviews of the web hosting companies?
Where have people here moved their iWeb website to?
ThanksI have been using IX Webhosting for about 4 years with little to no problems "usually the problem was something I did" and they have been quick to solve any issue I have come across.
As far as the unlimited is concerned they just do not set any pre-determined space or bandwidth.
I have several websites hosted on my hosting plan ( I am currently using the expert plan ) and haven't ran into any space issues here is my bandwidth (traffic) & disk space usage.
24/7 Customer Support by Phone, Chat, Ticket, Email
Though, I haven't took advantage of the phone support the Chat, Ticket, & Email support has been real responsive.
http://jeffnitschke.com/IXWebHosting.html
http://jeffnitschke.com/wordpress/2012/06/how-do-i-move-my-mobileme-site-ix-web- hosting-blog/
"I may receive some form of compensation, financial or otherwise, from my recommendation or link."
Maybe you are looking for
-
Can't adjust clip duration of still photos in iMovie '11
Anyone having the same problem? I inserted a still photo in one of my projects in iMovie which has a a clip duration of 5s when added. I clicked the cogwheel icon then chose the inspector to adjust the duration. I've managed to changed it to 3s but a
-
How do i instaill firefox 4 on eee pc 901 linux (xandros)??
''locking as a duplicate - https://support.mozilla.com/en-US/questions/818078'' hello. i am using an eee pc 901 with Xandros Linux on it, which currently has firefox 3.0.4 on it i need to run firefox 4 on it now, as some sites i use can not be used a
-
We used to be able to watch rented movies from Apple TV right away. Now it takes hours. Is there a setting to change? They used to start playing after a few minutes of starting the download but not now. What's up?
-
LabVIEW Programmer/ R&D Test Technologist WANTED in Windsor, ON, Canada
We are a growing manufacuting company focusing on the design and development of Radiant Thermal Sheet (RTS) technology leveraging our existing product line. We are currently looking for a R&D Technologist with expertise in the design development and
-
Creating aggregates in production !!!
Hi, I have a quick question regarding aggregates. Can I create and fill data in production without affecting the original cube. how about the performance. if some users are running queries out of that cube is it going to affect them.. thanks a lot. I