Question: Bidding on Ebay Write a program in a file Bid.java Begin with a correct Javadoc comment including your name and your partner's name, and the

Bidding on Ebay

  • Write a program in a file Bid.java
  • Begin with a correct Javadoc comment including your name and your partner's name, and the Assignment number, using the proper format demonstrated in class.
  • This program will read a user input for a bid and then re-display the bid in dollars and cents.
  • Note that you may assume the user enters a bid between $10.00 and $999.99.
    • No error checking of user input is required.
  • The user will enter only digits and must enter cents using two decimal places.
  • The program will then output to the console the price as a number of dollars and cents.
  • Required: The price must be stored as a String, not an int.
  • Required: You must use the charAt and length methods from the String class in your solution to this assignment
  • Required: You must use exactly one if statement and one else statement (the use of two if statements and the use of else if are both disallowed), to determine the number of dollars and cents
  • Required: You must use a char datatype to store whether the user typed y or n.
  • Important: Since there is no nextChar() option for the Scannerto read in a char using the Scanner, you will need to do the following:

char myChar = input.next().charAt(0); //reads input as a String and then extracts the first char

  • Required: You must use exactly one if statement and one else statement (the use of two if statements and the use of else if are both disallowed), to determine whether the user entered y or n
  • The use of else if will result in a 0 on this assignment.
  • The use of String methods we did not cover in class will result in a 0 on this assignment.
  • Your program should work identically to the examples below, including your formatting (except the user may input different values):

Sample Output:

Ebay Bidding! Enter a bid between $10.00 and $999.99: $29.95 You entered 29 dollars and 95 cents Is this bid correct (y/n): y Thank you for bidding! 

Sample Output:

Ebay Bidding! Enter a bid between $10.00 and $999.99: $299.00 You entered 299 dollars and 00 cents Is this bid correct (y/n): n Please re-run to place another bid.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!