ok i want to make a program to show a teacher at my school so i can get into computer Ap which teaches you java(but they say u have to know stuff to get in it makes no sense i am in highschool).
here is some seudocode and the code i already have.

int grades = 0;
		 boolean acceptance = true;//a variable to see if the user got accepted into the course
		   ask user ("what did u get in math");
		   input = grades //user inputs his math grades
			if (grades >= 89)
			  display ("you have a good chance of being accepted");
			else
			   display ("you still have a chance i would apply");
			ask user ("did you get into the course");
				if (acceptance = true)
				   display("nice, good job");
				 else
					 display("sorry, better luck next time")
			  end

here is wat i have so far already written in java

public class computer 
{

	public static void main(String[] args) 
	{
		boolean acceptance;
		int grades = 0;
		   System.out.println("what is your grade in math");
	    						 //need the input function right here
			  if (grades >= 89)
		   System.out.println("you have a good chance of getting into computer AP");
		 else 
		   System.out.println("you still have a chance but it will be harder to get in");
	}
			 
	}

So i need to know the input functions and do i need to end that before i can start the other if then statement with the boolean, and if anybody feels like they have time could u tell me how i would make this into a gui. Thank you for your help i really want to get into this course.

mikeandike22,

I think this is what you are trying to do...

import java.io.*;

import java.io.*;

public class Computer
{
	public static void main(String[] args)
	{
		boolean acceptance;
		int grades = 0;
		InputStreamReader stdin = new InputStreamReader(System.in);
		BufferedReader console = new BufferedReader(stdin);
		String acc = null;
		
		System.out.println("What is your grade in math?");
		try
		{
			grades = Integer.parseInt(console.readLine());
		}
		catch (IOException ex)
		{
			System.out.println("error reading input");
			ex.printStackTrace();
		}
		
		if (grades >= 89)
		{
			System.out.println("you have a good chance of getting into computer AP");
		}
		else
		{
			System.out.println("you still have a chance but it will be harder to get in");
		}
		
		System.out.println("Did you get into the course?");
		try
		{
			acc = console.readLine();
		}
		catch (IOException ex)
		{
			System.out.println("error reading input");
			ex.printStackTrace();
		}
		
		if (acc.equals("yes") || acc.equals("ya"))
		{
			acceptance = true;
		}
		else
		{
			System.out.println("Sorry, Better luck next time.");
			acceptance = false;
		}
	}
}

let me know if you still want some help making this into a gui... and good luck with AP computer science... I am a senior in high school and I'm in that right now and it is the best class I've ever taken!

Sorry i didn't really have time to comment the code to help you understand better... but you should be able to pick it up.

ok i want to make a program to show a teacher at my school so i can get into computer Ap which teaches you java(but they say u have to know stuff to get in it makes no sense i am in highschool).

I would learn it over the summer if your taking it next year. You SHOULD NOT have to know the stuff to get it there, because they teach it from ground up. Although, you will struggle if you don't. I'm in AP comp sci right now, and I learned java over the summer and actually know it better than my teacher(hope it doesn't sound like im bragging), but there is a few kids who didn't know anything about programming when starting out, and they are really struggling. If you learn the junk, it becomes a lay out class for you.

lol ya... i was one of the kids who stuggled with ap comp sci at the beginning of this year... but im really picking up on it now!

well neways i didnt get in cuz my math grades suck ass, i dont know i guess just becuz i didnt get all a's in b in preclac and geometry (which are skills i will really need in a high school comp sci course*sarcastic) that i can get into the course. The thing is i know a lot more about java and comps then ppl who got in and i could prob learn all the stuff on my own just that colleges want you to take a course. I am still gonna try and get in, i am gonna see if my teacher from last year will give me a reccommendation.

Yeah but thanks neways guys, i understand most of that code.

well neways i didnt get in cuz my math grades suck ass, i dont know i guess just becuz i didnt get all a's in b in preclac and geometry (which are skills i will really need in a high school comp sci course*sarcastic) that i can get into the course. The thing is i know a lot more about java and comps then ppl who got in and i could prob learn all the stuff on my own just that colleges want you to take a course. I am still gonna try and get in, i am gonna see if my teacher from last year will give me a reccommendation.

Yeah but thanks neways guys, i understand most of that code.

You should be able to get an override form that your parents sign for you to get in. I think it's crap you can't right now, because this class isn't hard.

import java.util.Scanner; //Imports Scanner For user Input.
public class Main
{


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

    {
        //Were most of code in the Main class goes.
        Scanner keybd = new Scanner(System.in); //Set keybd to Scanner for Input
        double grade = 0; //Double to hold grade
        String acceptance = "N"; //Holds varible to tell if Accepted.

        System.out.println("Enter math Grade (Example 100.00 or 95.50): ");
        grade = keybd.nextDouble(); //Sets next double typed to doulbe grade

        System.out.println("You entered: "+grade);

        if (grade >= 89)
        {
            System.out.println();
            System.out.println("you have a good chance of being accepted");
        }else
        {
            System.out.println();
            System.out.println("you still have a chance I would apply");
        }


        System.out.println();
        System.out.println("Did you get Accepted? (Y/N): ");
        String clear = keybd.nextLine(); //Fix Skip Glitch.

        acceptance = keybd.nextLine(); //Get if user Accepted and Save to String

        if(acceptance.equalsIgnoreCase("y") || acceptance.equalsIgnoreCase("n"))
        {
            if(acceptance.equalsIgnoreCase("y"))
            {
                System.out.println("Nice, Good Job");
                System.exit(0);
            }else
            {
                System.out.println("Sorry, Better luck next time.");
                System.exit(0);
            }
        }else
        {
            System.out.println("Error: Invalid Entry.");
            System.exit(0);
        }

        System.exit(0);

    }

}

I would learn it over the summer if your taking it next year. You SHOULD NOT have to know the stuff to get it there, because they teach it from ground up. Although, you will struggle if you don't. I'm in AP comp sci right now, and I learned java over the summer and actually know it better than my teacher(hope it doesn't sound like im bragging), but there is a few kids who didn't know anything about programming when starting out, and they are really struggling. If you learn the junk, it becomes a lay out class for you.

Not to brag but i toke CS1 and CS2 at a County College and im the 13 year old computer nerd in School, Im in 8th Grade now. Im flunt in Java. I have a feeling next year Im going to get payed good for Java Tutoring. Herray For Nerdz! Remember people one day those retarts who make fun of you from school will be working for you one day and will be under your Raith! XD.. ..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.