Here is the incomplete code: import java.util.*; public class CandleShop { public static void main(String[] args) { Scan

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Here is the incomplete code: import java.util.*; public class CandleShop { public static void main(String[] args) { Scan

Post by answerhappygod »

Here is the incomplete code:
import java.util.*;
public class CandleShop
{
public static void main(String[] args)
{
Scanner consoleReader = new Scanner(System.in);
// consoleReader is now object that will read from console
String divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
System.out.println(divider + " START MY CANDLESHOP APP " +
divider + "\n");
System.out.println(" Welcome to the Dorky Iguana Candle Shop!
\n");
// make three candles
Candle candle1 = new Candle("Killer Candle", 1, 3.39, 120);
Candle candle2 = new Candle("Gummy Worms", 2, 4.44, 108);
Candle candle3 = new Candle("Cookies n Cream", 3, 2.23, 60);
System.out.println("\t" + candle1.toString() + "\n\t" + candle2
+ "\n\t" + candle3);
System.out.print("\nAre these candles acceptable? (Yes/No)
");
String input = consoleReader.nextLine();
if(input.equalsIgnoreCase("No"))
{
System.out.print("\nWhat is the name of candle type 1: ");
String candleName1 = consoleReader.nextLine();
System.out.print("What is the cost of candle type 1: ");
double candleCost1 = consoleReader.nextDouble();
System.out.print("What is the burn time of candle type 1:
");
int candleBurnTime1 = consoleReader.nextInt();
consoleReader.nextLine();
candle1.setName(candleName1);
candle1.setCost(candleCost1);
candle1.setTime(candleBurnTime1);
System.out.print("\nWhat is the name of candle type 2: ");
String candleName2 = consoleReader.nextLine();
System.out.print("What is the cost of candle type 2: ");
double candleCost2 = consoleReader.nextDouble();
System.out.print("What is the burn time of candle type 2:
");
int candleBurnTime2 = consoleReader.nextInt();
consoleReader.nextLine();
candle2.setName(candleName2);
candle2.setCost(candleCost2);
candle2.setTime(candleBurnTime2);
System.out.print("\nWhat is the name of candle type 3: ");
String candleName3 = consoleReader.nextLine();
System.out.print("What is the cost of candle type 3: ");
double candleCost3 = consoleReader.nextDouble();
System.out.print("What is the burn time of candle type 3:
");
int candleBurnTime3 = consoleReader.nextInt();
consoleReader.nextLine();
candle3.setName(candleName3);
candle3.setCost(candleCost3);
candle3.setTime(candleBurnTime3);
System.out.println("New Values: \n\t" + candle1.toString() +
"\n\t" + candle2 + "\n\t" + candle3);
}
/* System.out.print("Yo. Type something here: "); // note colon,
& print, not println.
String inputtedText = "";
inputtedText = consoleReader.nextLine();
System.out.println("It appears you typed in: \"" + inputtedText
+ "\".");
// clean punctuation! Note the escape character \ to include
quotes within quotes
String errorMsg = "Ah-Ah-Ah, you didn't say the magic
word.";
errorMsg.toUpperCase();
System.out.println(errorMsg.indexOf("AH"));
double x = 5/2;
System.out.println(x);
*/
System.out.println("\n" + divider + " END CANDLESHOP " +
divider);
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply