Results 1 to 3 of 3
  1. #1
    diamondeyes is offline Member
    Join Date
    Nov 2010
    Posts
    5
    Rep Power
    0

    Default Problems printing if statements

    Thank you for anyone who takes a look at this for me.
    I have been working on it all day. I can get it to compile, but I can not get it to print my if statements. I am attaching what I have got. Any help would be wonderful.
    Java Code:
    import javax.swing.JOptionPane;
    
    public class CollegeAdmissions2
    	{
    		public static String accepted(double gpa, double entScore)
    		{
    		String decision;
    		
    		
    		if(gpa >= 3.0 && entScore >= 60 || entScore >= 85 && gpa >= 0)
    				decision = ("We are pleased to accept you at our school.");
    				
    		else
    			decision =  ("I am sorry, based on your scores," + "\n We cannot accept you at this time");
    			
    		if(!(gpa > 0 && gpa <= 4.0 && entScore >= 0 && entScore <= 100))
    			 decision =  ("You have entered invalid data");
    			
    		
    		return decision;
    			 
    		}
    
    		
    		public static void main(String[] args)
    		{
    		double gpa;
    		double entScore;
    		
    		gpa = Double.parseDouble(JOptionPane.showInputDialog (null,"Please enter your grade point average:"));
    		entScore = Double.parseDouble(JOptionPane.showInputDialog (null,"Please enter your entrance score:"));
    		System.out.println("Welcome the Admissions Department");
    		System.out.println("Your gradepoint average is: " + gpa);
    		System.out.println("Your entrance score is: " + entScore);
    		
    				
    		String decision;
    		decision = accepted(gpa, entScore);
    		
    		}
    		
    }
    Last edited by diamondeyes; 12-16-2010 at 08:56 PM.

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    4

    Default

    If I understand the issue correctly, you're just looking to add a System.out.println(decision); after decision = accepted(gpa, entScore);.

    (PS: In the future, please wrap code in [code][/code] tags.)

  3. #3
    diamondeyes is offline Member
    Join Date
    Nov 2010
    Posts
    5
    Rep Power
    0

Similar Threads

  1. Replies: 6
    Last Post: 11-03-2010, 02:33 PM
  2. Problem to stop printing statements
    By Rekuta in forum New To Java
    Replies: 1
    Last Post: 05-13-2010, 06:05 PM
  3. Replies: 3
    Last Post: 12-03-2009, 10:05 PM
  4. Printing ranges of numbers using if/else statements
    By russbuss106 in forum New To Java
    Replies: 8
    Last Post: 03-05-2009, 05:03 AM
  5. Problems with packages (import statements)
    By ai_2007 in forum Advanced Java
    Replies: 1
    Last Post: 06-29-2007, 11:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •