The Artima Developer Community
Sponsored Link

Java Answers Forum
Please help

1 reply on 1 page. Most recent reply: Oct 27, 2003 6:04 AM by Joe Parks

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Tony

Posts: 3
Nickname: maximus
Registered: Oct, 2003

Please help Posted: Oct 27, 2003 3:45 AM
Reply to this message Reply
Advertisement
All I am trying to do is read an integer from the keyboard and display it on screen. The program calculates a grade average

import java.io.*;

class keyboardReader {

//main method
public static void main(String [] args) {

KeyboardReader kb = new KeyboardReader();

//declaration of variables
double prog_mark;
double ass_mark;
double writ_mark;

//prints a string to screen
System.out.println("Enter the program mark ");
prog_mark = kb.getDouble();
System.out.println("Enter the assignment mark ");
ass_mark = kb.getDouble();
System.out.println("Enter the written mark ");
writ_mark = kb.getDouble();

//calculates grade percentage

int total = ((prog_mark * 4)/10 + (ass_mark * 3)/10 + (writ_mark * 3)/10);
System.out.print(total + "%");
}
}


Joe Parks

Posts: 107
Nickname: joeparks
Registered: Aug, 2003

Re: Please help Posted: Oct 27, 2003 6:04 AM
Reply to this message Reply
It would help greatly if you could describe the problem.

Upon first glance, though, you have a typo. Java is case-sensitive. The class is declared as "keyboardReader," but you have a variable declared as type "KeyboardReader".

Flat View: This topic has 1 reply on 1 page
Topic: urgent help needed Previous Topic   Next Topic Topic: integrate packages into an app

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use