Average Grade using If else..1 error please help

Hi all..Okay I have to do this program that lets you input student info and 3 grades, figures out the average, and the letter grade using if else statements. I have only one error and cannot figure it out. Here is the error and a copy of my program. If someone can help me figure it out, I would appreciate it; I have tried everything I can think of. Thank you.
Error: Illegal start of expression for this line           {if (avg >=80)&&(avg <90)
Here is my program:
class my_main
     public static void main (String [] args) throws IOException
     String Name;
     String ID;
     double grade1;
     double grade2;
     double grade3;
     BufferedReader stdin;
     stdin= new BufferedReader (new InputStreamReader (System.in));
     System.out.println ("Please enter the following information: ");
     System.out.print ("Student Name: ");
     Name= stdin.readLine();
     System.out.print ("Student ID: ");
     ID= stdin.readLine();
     System.out.print ("Grade One: ");
     grade1= Double.parseDouble(stdin.readLine());
     System.out.print ("Grade Two: ");
     grade2= Double.parseDouble(stdin.readLine());
     System.out.print ("Grade Three: ");
     grade3=Double.parseDouble(stdin.readLine());
     gradebook pt= new gradebook (grade1, grade2, grade3, Name, ID);
     pt.display ();
class gradebook
     int LG;
     double gr1;
     double gr2;
     double gr3;
     double avg;
     String SName;
     String IDNO;
     public gradebook (double grade1, double grade2, double grade3, String Name, String ID) throws ArithmeticException
     gr1= grade1;
     gr2= grade2;
     gr3= grade3;
     IDNO=ID;
     SName=Name;
     avg=(gr1+gr2+gr3)/3;
          if (avg >= 90)
          LG='A';
          else
          {if (avg >=80)&&(avg <90)
             LG='B';
          else
          {if (avg >=70)&&(avg <80)
                   LG='C';
          else
          {if (avg >=60)&&(avg <70)
             LG='D';
          else
          {if (avg <= 59)
             LG='F';
     void display()
     System.out.println ("Student Grades for "+SName);
     System.out.println ("Student ID Number: "+IDNO);
     System.out.println ("Grade One: "+gr1);
     System.out.println ("Grade Two: "+gr2);
     System.out.println ("Grade Three: "+gr3);
     System.out.println ("Average: "+avg);
     System.out.println ("Letter Grade: "+LG);
}

Hi ,
There were some problems like you have defined any main method etc. I have corrected your code, and it is working....
Sandeep
* my_main.java
* Created on October 6, 2003, 12:53 PM
import java.io.*;
* @author sandeep
public class my_main {
public static void main(String args[]) throws IOException {
String Name;
String ID;
double grade1;
double grade2;
double grade3;
BufferedReader stdin;
stdin= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter the following information: ");
System.out.print("Student Name: ");
Name= stdin.readLine();
System.out.print("Student ID: ");
ID= stdin.readLine();
System.out.print("Grade One: ");
grade1= Double.parseDouble(stdin.readLine());
System.out.print("Grade Two: ");
grade2= Double.parseDouble(stdin.readLine());
System.out.print("Grade Three: ");
grade3=Double.parseDouble(stdin.readLine());
gradebook pt= new gradebook(grade1, grade2, grade3, Name, ID);
pt.display();
class gradebook {
int LG;
double gr1;
double gr2;
double gr3;
double avg;
String SName;
String IDNO;
public gradebook(double grade1, double grade2, double grade3, String Name, String ID) throws ArithmeticException {
gr1= grade1;
gr2= grade2;
gr3= grade3;
IDNO=ID;
SName=Name;
avg=(gr1+gr2+gr3)/3;
if (avg >= 90) {
LG='A';
} else if ((avg >=80)&&(avg <90)) {
LG='B';
} else if ((avg >=70)&&(avg <80)) {
LG='C';
} else if ((avg >=60)&&(avg <70)) {
LG='D';
} else if (avg <= 59) {
LG='F';
void display() {
System.out.println("Student Grades for "+SName);
System.out.println("Student ID Number: "+IDNO);
System.out.println("Grade One: "+gr1);
System.out.println("Grade Two: "+gr2);
System.out.println("Grade Three: "+gr3);
System.out.println("Average: "+avg);
System.out.println("Letter Grade: "+LG);

Similar Messages

  • My iPhone is recognized by iTunes, but cannot be used. I've uninstalled and re-installed iTunes a zillion times and I do not know what else to do ,please help!

    My iPhone is recognized by iTunes, but cannot be used. I've uninstalled and re-installed iTunes a zillion times and I do not know what else to do ,please help!
    These are the errors I currently receive:
    https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-snc7/400030_10151379667022394_ 1296660655_n.jpg
    https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-snc7/399979_10151379647197394_ 588584161_n.jpg

    Hi sayla,
    When you reloaded your software did you do a clean reload (deleting all data)? http://bbry.lv/bpv7DT
    If so, you might try doing a resettofactory using the following instructions. http://bit.ly/fMW9I4 This will reset to factory default.
    -FS
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • I cannot use iCloud on Windows 7, as it won't recognize my apple ID when i try to sign in to icloud it i get error saying "you can't sign in because of a server error (please help some one)

    I cannot use iCloud on Windows 7, as it won't recognize my apple ID when i try to sign in to icloud it i get error saying "you can't sign in because of a server error (please help some one)

    Although your message isn't mentioned in the symptoms, let's try the following document with that one:
    Apple software on Windows: May see performance issues and blank iTunes Store

  • I am geting following error please help

    ERROR-
    RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.nature.com/principles/webservice/login" errorID=2032]. URL: http://www.nature.com/principles/webservice/login"]
    code-
    operation = new Operation(null, "login");
      operation.url = "login";
      argsArray = new Array("login_id", "login_password", "unique_machine_id");
      operation.argumentNames = argsArray;
      operation.method = "POST";
      operation.serializationFilter = filter;
      operations.push(operation);
      public function login(loginId:String, loginPassword:String, uniqueMachineId:String):AsyncToken
           trace(loginId, loginPassword, uniqueMachineId);
           var _internal_operation:AbstractOperation = _service.getOperation("login");
           var _internal_token:AsyncToken = _internal_operation.send(loginId, loginPassword, uniqueMachineId);
           return _internal_token;
    login service is being called from server that is in java-
    package com.nature.ebook.components.auth
      import com.nature.ebook.data.UserInfo;
      import com.nature.ebook.services.CallStatus;
      import com.nature.ebook.services.IEBookService;
      import com.nature.ebook.services.XMLServiceParser;
      import flash.events.EventDispatcher;
      import flash.events.IEventDispatcher;
      import mx.controls.Alert;
      import mx.rpc.AsyncToken;
      import mx.rpc.Fault;
      [ManagedEvents("authSuccess, authFail")]
      public class AuthCommand extends EventDispatcher
      public function AuthCommand(target:IEventDispatcher=null)
      [Inject]
      public var service:IEBookService;
      [Inject]
      public var auth:AuthModel;
      //  Methods
      * This command dispatches  event AuthenticationEvent.AUTH_FAIL when the service return failt
      * @param fault Fault
      public function error(fault:Fault):void
      trace(fault);
      var e:AuthenticationEvent = new AuthenticationEvent(AuthenticationEvent.AUTH_FAIL, null, null, CallStatus.getServerFaultCall());
      dispatchEvent(e);
      * This command dispatches event when the service return rezult Array
      * @param result Array
      * if cs.success <code>true </code> dispatch AuthenticationEvent.AUTH_SUCCESS
      * if cs.success <code>false</code> dispatch AuthenticationEvent.AUTH_FAIL
      public function result(result:*):void
      if (result)
      var cs:CallStatus = XMLServiceParser.getCallStatus(result);
      if (cs.success)
      var us:UserInfo = XMLServiceParser.getUserInfo(result);
      var e:AuthenticationEvent = new AuthenticationEvent(AuthenticationEvent.AUTH_SUCCESS, us, null, cs);
      dispatchEvent(e);
      else
      e = new AuthenticationEvent(AuthenticationEvent.AUTH_FAIL, null, null, cs);
      dispatchEvent(e);
      public function execute(event:AuthenticationEvent):AsyncToken
      return service.login(event.user.loginId, event.magicWord, event.user.uniqueMachineId);

    Sorry for the confusion. After starting the WLS 6.0 server, use your browser
    to launch the console, verify that the Frobable EJB is correctly deployed as
    frobtarget with the correct class path specified. The 6.0 JAAS sample is
    trying to invoke on examples.security.acl.Frobable, make sure this is the
    deployed instance. This is an error in the JAAS example SampleAction.java
    file since the JAAS sample actually builds examples.security.jaas.Frobable,
    this bug will be corrected in service pack 1 which will be available
    shortly.
    nancy coelho <[email protected]> wrote in message
    news:3a9ee0af$[email protected]..
    Hi! I am new to JAAS and also to Weblogic server6.0. I am trying to run
    JAAS sample and geting the following error . please help
    Thanks,
    Nancy
    E:\bea\wlserver6.0\samples>java examples.security.jaas.SampleClient
    t3://localho
    st:7001
    Using Configuration File: Sample.policy
    Login Module Name: examples.security.jaas.SampleLoginModule
    Login Module Flag: required
    username: ncoelho
    password: prabhala
    javax.naming.NameNotFoundException: Unable to resolve frobtarget.Resolved:
    '' U
    nresolved:'frobtarget' ; remaining name ''
    at
    weblogic.rmi.internal.AbstractOutboundRequest.sendReceive(AbstractOut
    boundRequest.java:90)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:247)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:225)
    at
    weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(ServerNamingNod
    e_WLStub.java:121)
    at
    weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    at examples.security.jaas.SampleAction.run(SampleAction.java:61)
    at javax.security.auth.Subject.doAs(Subject.java:80)
    at examples.security.jaas.SampleClient.main(SampleClient.java:114)
    Failed to frob
    E:\bea\wlserver6.0\samples>

  • Windows - No Disk Error - Please help!

    Windows - No Disk Error - Please help!
    Hi,
    I have the following set up:
    * Lenovo T-61p
    * Windows XP Pro, SP 3
    * HP Photosmart 8250 printer (with nothing plugged into the various card readers, and USB slot in the printer)
    I am getting the following error:
    Windows - No Disk
    Exception Processing Message 0xc0000013 Parameters 0x75CE023C
    0x84C40C84 0x75CE023C
    I have done a lof experimenting and thru process of  elimination, and believe I have determined that this only happens when the HP Photosmart 8250 printer is plugged in to the USB slot of the computer.
    I can stop it from happening by safely removing hardware, and removing the drive that the 8250 creates on your computer when you plug it in.  In my case, this is drive E.  I'm guessing if there was something in the the various card readers, and USB slot in the printer, that's what those would be, but I don't those use those functions of the printer.
    I understand there is more at work than simply the printer, because I did not used to get this error, so some software changed as well, that is scanning all ports, and finding a drive that has no disk, and producing the error.
    A simple google search finds a lot people all over the world having this problem, and are solving it in different ways, because the suspected source is different: Norton, HP, etc.
    I have tried everything I have read, and the only thing that works was my own idea, of manually safely removing the drive the printer creates each time I plug in the printer.
    Anyone every any better, more permanent solutions?  Or know what the real root of the problem is?  What is scanning all the drives and being showing an error message because it found an empty drive?
    Thanks and Happy Holidays/New Year!

    I've been getting the same error on my 4G nano for the past week. I've had my nano for about a month and the first few weeks were fine. Tried it on 2 different computers (Vista and XP) and same problem. Tried it on a 3rd (XP) and it started ok. Problem started coming back after a day.
    I was able to find a quick fix though. I noticed that sometimes the message says something like "iexplore.exe... no disk..." even if I don't even use IE. What I do is end iexplore.exe on task manager before running iTunes and syncing my nano. I don't get the error whenever I do this, but one drawback is that the contents of my nano suddenly pops up in a window - even when disk use is not enabled.
    I've reset/restored my nano dozens and dozens of times to make sure it's clean. Leads me to believe it's a driver issue. Either that or I have a friggin malware problem I can't seem to find.
    I'll be posting updates every now and then. I'm no expert so I'm hoping an Apple expert also steps in to give some input.

  • My ipod generation 5 will not come out of recovery mode. i was simply updating my software and this happened. it will not let me restore it comes up with and error. please help, thanks.

    my ipod generation 5 will not come out of recovery mode. i was simply updating my software and this happened. it will not let me restore it comes up with and error. please help, thanks.

    Hey erinoneill24,
    Thanks for using Apple Support Communities.
    Sounds like you can't update your device. You don't mention an error that it gives you. Take a look at both of these articles to troubleshoot.
    iPod displays "Use iTunes to restore" message
    http://support.apple.com/kb/ts1441?viewlocale=it_it
    If you can't update or restore your iOS device
    http://support.apple.com/kb/HT1808?viewlocale=de_DE_1
    If you started your device in recovery mode by mistake, restart it to exit recovery mode. Or you can just wait—after 15 minutes the device will exit recovery mode by itself.
    Have a nice day,
    Mario

  • I am not able to update my iphone 4 ,when ever i tried to update it its show 1309 error...and at times 9006 error ,please help me ..

    i am not able to update my iphone 4 ,when ever i tried to update it its show 1309 error...and at times 9006 error ,please help me ..

    Hey alkarim2008,
    If you are having an issue with being unable to update or restore your iPhone, I would suggest that you troubleshoot using the steps in this article - 
    Resolve iOS update and restore errors in iTunes - Apple Support
    Thanks for using Apple Support Communities.
    Happy computing,
    Brett L 

  • I have Xerox 3140 printer. Mountain Lion version can not use my printer. could you please help me. I know little English. I would like to thank those who help.

    I have Xerox 3140 printer. Mountain Lion version can not use my printer. could you please help me. I know little English. I would like to thank those who help.

    I have a small office. I have three devices mac mini osx 10.08. your suggestions helped me. I would like to thank. I liked your help. partially solved the problem .. I installed the drivers from the other computers on the network. When printing a document, "no pages found" error occurs. and can not print the document. please help me. I do not want to get a new printer. thank you for friendship ...

  • When iPhone is connected to PC, it shows in itunes but Autoplay does not open for me to copy photos. I tried the Control Panel, changing Autoplay settings but no use. I use a Windows Vista. Please help! All my little ones' pictures are on my iPhone 3GS

    When iPhone is connected to PC, it shows in itunes but Autoplay does not open for me to copy photos. I tried the Control Panel, changing Autoplay settings but no use. I use a Windows Vista. Please help! All my little ones' pictures are on my iPhone 3GS.
    I tried hard reset on my iPhone. I tried restarting laptop and iPhone. I tried a different laptop. I tried removing driver and reinstalling from Device Manager but did not find a driver other than "Apple Mobile Device USB Driver" under "Universal Serial Bus controllers" which I heard shouldn't be uninstalled.
    Anything I haven't tried?
    HELP!

    A bit confused by your statement
    bcboarder wrote:
    . I do not understand why the music is clearly on the Ipod but wont reconize it anywhere.
    Are you seeing your music listed in the iPod screen, or in Win explorer as in your earlier post?
    I can see all the songs in my Edrive>al's Ipod> Ipod Control> Music folder.
    A corrupted iPod database, will report zero music used, and have your music size reported as others, so you wont see the music in the iPod screen. Sorry, I thought there was some hope for you with iPodAccess, in recovery of the corrupted iPod database with your ratings.
    You can try to borrow and  use the Mac Disk Utility ->First Aid ->Repair.
    Of course, if your iPod Hardisk is in a bad state, from the Disk Diagnostic report, then all my suggestion are futile.

  • I am unable to download my PDF. It is asking for my adobe livecycle rights management credentials. I have no clue what that is. I am using a PC windows7. Please help me.

    I am unable to download my PDF. It is asking for my adobe livecycle rights management credentials. I have no clue what that is. I am using a PC windows7. Please help me.

    Downloading from where?  How exactly are you downloading?
    Can you post a screenshot of that message: https://forums.adobe.com/thread/1070933

  • I recently bought a dbx hardware compressor and am not quite sure how to use it in logic express 9. I hav a focusrite saffire 6 usb audio interface and am not dont how to use it in logic. Please help???

    I recently bought a dbx hardware compressor and am not quite sure how to use it in logic express 9. I hav a focusrite saffire 6 usb audio interface and am not dont how to use it in logic. Please help???

    MUYconfundido wrote:
    Pancenter,
    Thanks for the response, but I do not have a midi interface. I am using a midi to usb connector cable, thus bypassing the need for a Midi interface.
    The Mac reads the USB cable as a midi device, but not the keyboard that I am trying to use as a controller. I have tried it with my korg sp 300 and with my Nord Electro 2.
    Thoughts?
    Thanks,
    Tristan
    Tristan...
    This is what you have, correct?
    http://www.alesis.com/usbmidicable
    This from Alesis..
    "The AudioLink Series USB cable receives and outputs MIDI signal thanks to its internal interface. The USB-MIDI Cable connects plug-and-play to your Mac or PC for an all-in-one USB-MIDI solution."
    Notice, -internal interface-. What you have is a simple USB MIDI Interface. Most MIDI interfaces are USB.
    My point is (was), MIDI OUT of the Korg goes to the connector marked MIDI IN on the Alesis, those new to MIDI often get this wrong.
    pancenter-

  • Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Until recently I was able to send images in the body of my Yahoo emails. Now, I am getting the message "This message has been truncated", and the email does not go through. I do not have this problem using IE. Could you please help? Thank you.

    Try this -> http://support.apple.com/kb/TA38632?viewlocale=en_US

  • HT201442 I did this but still i am getting the same error , please help me .

    I did this but still i am getting the same error , please help me .
    <Email Edited by Host>

    Look at http://support.apple.com/kb/ts4451
     Cheers, Tom

  • My iphone won't pass the connect to itunes. when i try to restore is says that there is an error. please help!

    hi my iphone is broken. it won't pass the connect to itunes. when i try to restore is says that there is an error. please help!
    thanks,
    jg2013
    <Subject Edited by Host>

    Hello, 02633. 
    Thank you for visiting Apple Support Communities. 
    If your iPhone is disabled, you will need to process the steps in the article below.
    iOS: Forgotten passcode or device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    Cheers,
    Jason H.

  • HT4623 I have updated my iphone with the current software but it is showing you need to connect to  of itunes to activate your phone, when i did that it is continuously showing an error.please help me to get through.

    I have updated my iphone with the current software but it is showing you need to connect to  of itunes to activate your phone, when i did that it is continuously showing an error.please help me to get through.
    Kindly Activate my phone.

    Rajan Gupta wrote:
    ...it is continuously showing an error.
    See here  >  http://support.apple.com/kb/TS3424
    Also see this discussion.
    https://discussions.apple.com/message/21189708

Maybe you are looking for

  • Do I have to have an apple ID to simply activate the phone on my iPad?

    I added a new iPhone 4 to my AT&T account yesterday for my Father-in-law.  ($49.99 at BestBuy so probably a refurb).  They were supposed to have activated the phone before I left the store.  I bailed out of the store in a hurry and didn't ask them to

  • Domain bindings doesn't show short text of domains

    Hello forum, I am facing a problem in a bsp view. I want to create a dropdownListBox where the values displayed are the short text values in the domain. I found a SDN guide (https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/72d7ac11

  • Can I activate my iphone 3GS using an older version of itunes?

    I ordered an iphone 3GS on contract through t-mobile and I need to activate it but I have an slightly out of date itunes. My mac is running OSX 10.4 so I cannot get the latest version. Will I still be able to activate my iphone or can I get it activa

  • Bpel tutorial help !!!

    I am very new to the world of SOA and BPEL.. trying to follow tutorials and samples and am stuck at Loan Processing Tutorial http://download.oracle.com/docs/cd/B14099_19/integrate.1012/b15604/loandemo.htm#hytrlvjjh at instruction #5.. Tutorial simply

  • Mac cycling through blue startup screen and desktop after installing app...

    Hi again folks! I'm hoping I can pick your brains on this one, as it's got me scratching my head here... My fiance just accidentally installed a 64bit version of Handbrake on her white macbook (running Leopard 10.5.8, I believe). The battery on her m