Answer:
In java, Write an expression that continues to bid until the user enters 'n'.
import java.util.Random;
import java.util.Scanner;
public class AutoBidder {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
Random randGen = new Random();
char keepGoing = '-';
int nextBid = 0;
randGen.setSeed(5);
while (/* Your solution goes here */) {
nextBid = nextBid + (randGen.nextInt(10) + 1);
System.out.println("I'll bid $" + nextBid + "!");
System.out.print("Continue bidding? ");
keepGoing = scnr.next().charAt(0);
}
System.out.println("");
return;
}
}
Explanation:
Hope it's help you ;)
Java is a high-level programming language that has a concise syntax and is designed to be platform-independent. It is also a multi-paradigm programming language, which means that it supports a variety of programming styles, including object-oriented, imperative, and functional programming.
A do-while loop is a control flow statement that executes a block of code at least once before testing the condition. In other words, the loop will always execute once before checking the condition to see if it should execute again.
To implement a program that continues to bid until the user enters 'n' in Java, you can use a do-while loop. Here is an example:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String response;
do {
System.out.println("Enter your bid:");
int bid = scanner.nextInt();
System.out.println("You bid " + bid);
System.out.println("Do you want to continue bidding? (y/n)");
response = scanner.next(); }
while (!response.equals("n"));
System.out.println("Bidding is over."); }}
This program prompts the user to enter a bid, displays the bid, and then prompts the user to enter 'y' to continue bidding or 'n' to stop bidding. If the user enters 'n', the program will exit the loop and display a message that bidding is over. In conclusion, you can use a do-while loop in Java to implement a program that continues to bid until the user enters 'n'.
To learn more about Java, visit:
https://brainly.com/question/31561197
#SPJ11