Hello,
Can anyone help me with what is wrong with my code? -
import javax.swing.JOptionPane;
-
public class CollegeAdmission
-
{
-
public static void main(String args[])
-
{
-
// Declare variables
-
String testScoreString;
-
String classRankString;
-
int testScore;
-
int classRank;
-
-
-
-
-
-
-
-
-
-
-
// Get input and convert to correct data type
-
-
{ input testScoreString = JOptionPane.showInputDialog("Enter testScore");
-
input classRankString = JOptionPane.showInputDialog("Enter ClassRank");
-
testScore = Integer.parseInt(testScoreString);
-
classRank = Integer.parseInt(classRankString);
-
-
}
-
-
-
-
-
-
-
-
// test using admission requirements and print Accept or Reject
-
-
-
{ if( classRank >= 25)
-
{
-
System.out.println("Accept");
-
}
-
else
-
System.out.println("Reject");
-
}
-
-
{
-
if( testScore >= 80 )
-
{
-
if( classRank >= 50 )
-
System.out.println("Accept");
-
else
-
System.out.println("Reject");
-
}
-
else
-
{
-
if( testScore >= 70 )
-
{
-
if( classRank >=75 )
-
System.out.println("Accept");
-
else
-
System.out.println("Reject");
-
}
-
else
-
{ System.out.println("Reject");
-
}
-
-
-
-
} // End of main() method
-
-
} // End of CollegeAdmission class
-
}
9 1343 @blondee
What's wrong with it? Does it compile? If not, what does the compiler say? (cut and paste please). If it does compile what does your program do what it isn't supposed to do? What is it supposed to do?
kind regards,
Jos
My guess based on your code would be:
testScore = Integer.parseInt(testScoreString);
If the user doesn't enter an integer, it'll throw an error, and you seem to have no error checking, no try-catch.
Otherwise, as stated above, you'll have to be specific about your problem.
@jkmyoung
That's not it; the NumberFormatException extends the RuntimeException so you can get away with it without mentioning it in a throws clause. But again: the OP can't just dump a bunch of (badly formatted) code here, throw the hands up in the air and wait for a spoonfeeding solution.
kind regards,
Jos
im new here first of all i intoduce my self , im student of c++ , and my exmaz are near , i ve joined acadmy to undersatnd this but im facing problem in undersatnding programs still. so i need ur help, experts plz meke me expert in progrmaing,
i dont know how can i creat logic plz plz do reply me fast i will wait
At the top of the Java forum thread listing is a thread called "Read this first". It contains links that you need badly.
P.S What is exmaz?
first of all thnx for ur reply
EXAMS means examination, final papers like final test
i ve read that topic
plz i want to understand it step by step
when ever i open my book every program is different from other program
make one simple program of if statement then understand me what is the first step
waiting for ur reply
@tahira: unless your other handle is 'blondee' this is not your thread; hijacking someone else's thread is considered rude. You should've started your own thread instead of taking over this thread.
kind regards,
Jos (moderator)
ps. This is the Java forum; for C and C++ questions there exists a C and C++ forum.
i m giving u one statment please make program according to statmeent then tell me how u hve make it
WRITE a program to get two numbers from keyboard during program execution. calculate the sum and product of the numbers and tehn print the result on the computer, ?
and also give me some sort of tips
thans in advance
Read Jos' reply (#8) above again.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dave |
last post by:
After following Microsofts admonition to reformat my system before doing a
final compilation of my app I got many warnings/errors upon compiling an rtf
file created in word. I used the Help...
|
by: Tom |
last post by:
A question for gui application programmers. . .
I 've got some GUI programs, written in Python/wxPython, and I've got
a help button and a help menu item. Also, I've got a compiled file
made with...
|
by: wukexin |
last post by:
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing...
|
by: Colin J. Williams |
last post by:
Python advertises some basic service:
C:\Python24>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
With...
|
by: Corepaul |
last post by:
Missing Help Files
When I enter "recordset" as the keyword and search the Visual Basic Help index,
I get many topics of interest in the resulting list. But there isn't any
information available...
|
by: Steve |
last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp
My expectation is that a developer using my DLL would be able to access this help file during his development time...
|
by: Mark |
last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my
home computer has an abbreviated help screen not 2% of the help on my laptop.
All the settings look the same on both...
|
by: JonathanOrlev |
last post by:
Hello everybody,
I wrote this comment in another message of mine, but decided to post it
again as a standalone message.
I think that Microsoft's Office 2003 help system is horrible, probably...
|
by: trunxnirvana007 |
last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
'UPGRADE_WARNING: Couldn't resolve...
|
by: hitencontractor |
last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003.
I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About.
The application...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |