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


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Java Homework Help

  1. #1
    Junior Member
    Join Date
    Oct 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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 class QuadEval
    {
    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. #2
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default 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. #3
    Junior Member
    Join Date
    Oct 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Homework Help

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

  4. #4
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default 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. #5
    Junior Member
    Join Date
    Oct 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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. #6
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default 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

Similar Threads

  1. Java Homework
    By Dimo62 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 8th, 2013, 11:57 AM
  2. Replies: 8
    Last Post: February 12th, 2013, 05:45 AM
  3. New to Java. Need help with homework
    By ptison in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 26th, 2013, 05:53 PM
  4. Java Homework Help
    By JustDelta767 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 6th, 2012, 08:22 AM
  5. Help for java homework
    By Dark_Shadow in forum Object Oriented Programming
    Replies: 6
    Last Post: December 7th, 2009, 04:08 AM