Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## Java Homework Help

I am currrently new to programming so please bare with me.

This is for my Intro to Java programming class, the instructions are displayed in the picture.

import java.util.Scanner;
{
public static void main(String[] args)
{
int a, b, c, x;
Scanner s = new Scanner(System.in);
System.out.println("Given quadratic equation:ax^2 + bx + c");
System.out.print("Enter a:");
a = s.nextInt();
System.out.print("Enter b:");
b = s.nextInt();
System.out.print("Enter c:");
c = s.nextInt();
System.out.print("Enter x:");
x = s.nextInt();
System.out.println("Given quadratic equation:"+a+"x^2 + "+b+"x + "+c);

I am not sure if i am doing it right and what the next steps are, any help will be appreciated.

Capture.jpg

2. ## Re: Java Homework Help

Everything looks syntactically correct. Have you run it to see if performs as expected? The next step would be to calculate the value of z based on the independent variable x and the values of the coefficients a, b, and c.

Regards,
Jim

3. ## Re: Java Homework Help

Hi Jim, that is where I am stuck. I am not sure how to continue from here.

4. ## Re: Java Homework Help

I can't tell if your supposed to calculate the value or simply create a String as described in the example and then pass it on to some method that the instructor will provide. I can't really help much here. I would recommend you talk to your instructor or some of your classmates to get a clarification.

Regards,
Jim

5. ## Re: Java Homework Help

This is the required format for the output after running the code, I'm not sure if this helps.

Capture2.PNG

6. ## Re: Java Homework Help

According to the image it looks more like this.

[a=2.0][b=5.0][c=1.0][x=1.0]

Like I suggested before. All you may need to do is create that parameter string and submit it. You really should talk to someone who is involved with this class.

Regards,
Jim