.
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.
.
Last edited by Markusovich_; June 18th, 2019 at 12:41 AM.
Please copy the full contents of the console window and paste it here so we can see what happens when the code is executed.
A return statement will cause execution to return to the caller.
What do you want the code to do at the locations where there are now return statements?
Please edit your post and wrap your code with code tags:
[code]
**YOUR CODE GOES HERE**
[/code]
to get highlighting and preserve formatting.
If you don't understand my answer, don't ignore it, ask a question.
.
Last edited by Markusovich_; June 18th, 2019 at 12:41 AM.
Please copy the full contents of the console window and paste it here so we can see what happens when the code is executed.
What do you want the code to do differently at the locations where there are now return statements?
If you don't understand my answer, don't ignore it, ask a question.
dsgwehfdsbrsfdnfgdsnb
Last edited by Markusovich_; June 18th, 2019 at 12:39 AM.
You don't need to use return statement. Return statement will break the loop.
Modify your code to this
Driver
public class Driver { public static void main(String[] args) { CommisionCalculator hi = new CommisionCalculator(); hi.Run(); } }
In Run function, replace return statement with System.out.println. At the last line, add the input value to allow user to key in the input.
if (i == 1) { System.out.println("First name: "); String insured = scan.next(); System.out.println("Make: "); String make = scan.next(); System.out.println("Model: "); String model = scan.next(); System.out.println("Liability: "); double liability = scan.nextDouble(); System.out.println("Collision: "); double collision = scan.nextDouble(); a = new Auto(insured, make, model, liability, collision); System.out.println(a.Filler()); int value = scan.nextInt(); if(value == 4){ System.out.println(a.toString()); } }
Don't forget to remove all the return in each case statement.
Whatever you are, be a good one
Markusovich_ (June 18th, 2019)
Why you need to edit all your post?
Whatever you are, be a good one