Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1, Problem 15PE
Type in and run the following
import javax.swing.JOptionPane;
public class DialogViewer
{
public static void main(String[]args)
{
JOptionPane.showMessageDialog(nul1, "Hello, World!");
}
}
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Please help repeat this Java programming using the text method of input or output
import java.util.Scanner;
public class TriangleArea { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Triangle triangle1 = new Triangle(); Triangle triangle2 = new Triangle();
// TODO: Read and set base and height for triangle1 (use setBase() and setHeight()) // TODO: Read and set base and height for triangle2 (use setBase() and setHeight()) System.out.println("Triangle with smaller area:"); // TODO: Determine smaller triangle (use getArea()) // and output smaller triangle's info (use printInfo()) }}
public class Triangle { private double base; private double height; public void setBase(double userBase){ base = userBase; } public void setHeight(double userHeight) { height = userHeight; } public double getArea() { double area = 0.5 * base * height; return area; } public void printInfo() { System.out.printf("Base:…
Create a Flowchart
//Java Source Code :-
import java.util.Scanner;
public class bExpert {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("\nVALUES");
System.out.print("Value 1: ");
int v1 = sc.nextInt();
System.out.print("Value 2: ");
int v2 = sc.nextInt();
System.out.print("Value 3: ");
int v3 = sc.nextInt();
System.out.println("\nPROCESS");
System.out.println("\n1. Summation");
System.out.println("2. Product");
System.out.println("3. Min / Max");
System.out.println("4. Odd / Even");
char st = 'y';
while(st != 'n'){
System.out.print("\nCHOICE: ");
int ch = sc.nextInt();
switch(ch) {
case 1:
int sum = v1 + v2 + v3;
System.out.println("\nSum = "+sum);
break;
case 2:
int prod =…
Chapter 1 Solutions
Big Java Late Objects
Ch. 1.1 - What is required to play music on a computer?Ch. 1.1 - Why is a CD player less flexible than a computer?Ch. 1.1 - What does a computer user need to know about...Ch. 1.2 - Prob. 4SCCh. 1.2 - Which part of the computer carries out arithmetic...Ch. 1.2 - A modern smartphone is a computer, comparable to a...Ch. 1.3 - What are the two most important benefits of the...Ch. 1.3 - Prob. 8SCCh. 1.4 - Prob. 9SCCh. 1.4 - Prob. 10SC
Ch. 1.5 - How do you modify the HelloPrinter program to...Ch. 1.5 - How would you modify the HelloPrinter program to...Ch. 1.5 - Would the program continue to work if you replaced...Ch. 1.5 - What does the following set of statements print?...Ch. 1.5 - What do the following statements print?...Ch. 1.6 - Suppose you omit the "" characters around Hello,...Ch. 1.6 - Suppose you change println to Printline in the...Ch. 1.6 - Suppose you change main to hello in the...Ch. 1.6 - Prob. 19SCCh. 1.6 - Prob. 20SCCh. 1.7 - Prob. 21SCCh. 1.7 - Suppose your cell phone carrier charges you 29.95...Ch. 1.7 - Consider the following pseudocode for finding the...Ch. 1.7 - Suppose each photo in Self Check 23 had a price...Ch. 1.7 - Prob. 25SCCh. 1.7 - Prob. 26SCCh. 1 - Explain the difference between using a computer...Ch. 1 - Prob. 2RECh. 1 - Prob. 3RECh. 1 - Prob. 4RECh. 1 - Prob. 5RECh. 1 - Prob. 6RECh. 1 - What does this program print? public class Test {...Ch. 1 - What does this program print? Pay close attention...Ch. 1 - Prob. 9RECh. 1 - Write three versions of the HelloPrinter.java...Ch. 1 - How do you discover syntax errors? How do you...Ch. 1 - The cafeteria offers a discount card for sale that...Ch. 1 - Write an algorithm to settle the following...Ch. 1 - Consider the question in Exercise R1.13. Suppose...Ch. 1 - In order to estimate the cost of painting a house,...Ch. 1 - In How To 1.1, you made assumptions about the...Ch. 1 - Suppose you put your younger brother in charge of...Ch. 1 - Write pseudocode for an algorithm that describes...Ch. 1 - The ancient Babylonians had an algorithm for...Ch. 1 - Write a program that prints a greeting of your...Ch. 1 - Write a program that prints the sum of the first...Ch. 1 - Write a program that prints the product of the...Ch. 1 - Write a program that prints the balance of an...Ch. 1 - Write a program that displays your name inside a...Ch. 1 - Write a program that prints your name in large...Ch. 1 - Write a program that prints your name in Morse...Ch. 1 - Write a program that prints a face similar to (but...Ch. 1 - Write a program that prints an imitation of a Piet...Ch. 1 - Write a program that prints a house that looks...Ch. 1 - Write a program that prints an animal speaking a...Ch. 1 - Write a program that prints three items, such as...Ch. 1 - Write a program that prints a poem of your choice....Ch. 1 - Write a program that prints the United States...Ch. 1 - Type in and run the following program. Then modify...Ch. 1 - Type in and run the following program. Then modify...Ch. 1 - Modify the program from Exercise E1.16 so that the...Ch. 1 - Prob. 18PECh. 1 - Write a program that prints a two-column list of...Ch. 1 - In the United States there is no federal sales...Ch. 1 - To speak more than one language is a valuable...Ch. 1 - You want to decide whether you should drive your...Ch. 1 - You want to find out which fraction of your cars...Ch. 1 - The value of can be computed according to the...Ch. 1 - Imagine that you and a number of friends go to a...Ch. 1 - Write an algorithm to create a tile pattern...Ch. 1 - Write an algorithm that allows a robot to mow a...Ch. 1 - Consider a robot that is placed in a room. The...Ch. 1 - Consider a robot that has been placed in a maze....Ch. 1 - Suppose you received a loyalty promotion that lets...Ch. 1 - A television manufacturer advertises that a...Ch. 1 - Cameras today can correct red eye problems caused...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Word processing programs, spreadsheet programs, e-mail programs, Web browsers, and game programs belong to what...
Starting Out with C++: Early Objects (9th Edition)
List the functions of a database application.
Database Concepts (8th Edition)
Comprehension Check 8-15
You push an automobile with a constant force of 20 pound-force [lbf] until 1,500 joule...
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Explore the data included in Table 4-9. Assume that the primary key of this relation consists of two components...
Modern Database Management
What is a PictureBox control used for?
Starting Out With Visual Basic (8th Edition)
Give a statement that will close the stream toFile created for the previous two questions.
Java: An Introduction to Problem Solving and Programming (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Run this program and show the output. Thank youarrow_forwarduse the JCreator program for code in picture and show the outputarrow_forwardThis isn't not working for me. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userNum = in.nextInt(); int divNum = in.nextInt(); System.out.print("What is the user number?"); userNum = scnr.nextInt(); int a, b, c; a = userNum/divNum; System.out.println(a); b = a/divNum; System.out.println(b); c = b/divNum; System.out.println(c); }} ERROR LabProgram.java:6: error: cannot find symbol int userNum = in.nextInt(); ^ symbol: variable in location: class LabProgram LabProgram.java:7: error: cannot find symbol int divNum = in.nextInt(); ^ symbol: variable in location: class LabProgram 2 errorsarrow_forward
- The first one is answered as follows. Help with the second one. package test;import javax.swing.*;import java.awt.*;import java.awt.event.*; public class JavaApplication1 { public static void main(String[] arguments) { JFrame.setDefaultLookAndFeelDecorated(true);JFrame frame = new JFrame("print X and Y Coordinates");frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout());frame.setSize(500,400); final JTextField output = new JTextField();;frame.add(output,BorderLayout.SOUTH); frame.addMouseListener(new MouseListener() {public void mousePressed(MouseEvent me) { }public void mouseReleased(MouseEvent me) { }public void mouseEntered(MouseEvent me) { }public void mouseExited(MouseEvent me) { }public void mouseClicked(MouseEvent me) {int x = me.getX();int y = me.getY();output.setText("Coordinate X:" + x + "|| Coordinate Y:" + y);}}); frame.setVisible(true);}}arrow_forwardStringFun.java import java.util.Scanner; // Needed for the Scanner class 2 3 /** Add a class comment and @tags 4 5 */ 6 7 public class StringFun { /** * @param args not used 8 9 10 11 12 public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter your first name: "); 13 14 15 16 17 18 System.out.print("Please enter your last name: "); 19 20 21 //Output the welcome message with name 22 23 24 //Output the length of the name 25 26 27 //Output the username 28 29 30 //Output the initials 31 32 33 //Find and output the first name with switched characters 34 //All Done! } } 35 36 37arrow_forwardpublic class ReversedDigit { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Please enter a number: "); int number = scan.nextInt(); int reversedNumber = 0; do { reversedNumber = number%10; number = number/10; } while (number > 0); }} Modify the coding example, to count what is the total of all digits of a number. For example, when user enters 301, your output is 4 because 3+0+1=4; when user enters 5116, your output is 13 (5+1+1+6 = 13).arrow_forward
- package pwriter2; import java.util.Scanner; import java.io.*; public class Pwriter2 { public static void main(String[] args) throws IOException { PrintWriter tofile2 = new PrintWriter( "tooutfile2.txt" ); int i = 0; while (i < 10){ tofile2.println( i ); i = i + 1; } tofile2.close(); } } What is the output?arrow_forwardJava Language Please help me fix all the error. I very appreciate it Coding: import java.util.Scanner;public class Main { /*static displayline(); char line; { for (int i = 1; i < line; i++ ) { System.out.println ("_"); } } */ public static void main(String[] args) { System.out.println("Clinic Management\n"); int PatAge, Pnumber,age; int cmedicine, cost, Pcost, total, newTotal; String PatName, Pgender, Pdisease, Pmedicine; char typeofmedicine; Scanner scan = new Scanner(System.in); System.out.println("Patient Name :"); String name = scan.next(); name = name + scan.nextLine(); System.out.println("Patient Age :"); age = scan.nextInt(); System.out.println("Patient Gender :"); String gender = scan.next(); System.out.println("Patient Phone Number :"); Pnumber = scan.nextInt(); System.out.println("Patient Disease :" ); String disease =…arrow_forwardFirst, you will debug the Paint1 class so that no errors remain and all calculations work correctly by completing the following: o Find and fix the three errors in the given code. • Use the following sample input values to test your program. If you have found and fixed all the errors, your output should exactly match the sample. Input: 30 25 Output: Wall area: 750.0 square feet Paint needed: 2.142857142857143 gallons Tip: When you run your program in Eclipse, it will prompt you to enter input in the Console window. If you cannot find this window, go to Window, then Show View, then Console. Next, you will add loops to validate all user input and handle exceptions so that code passes all test cases by completing the following: • Review the code, looking for the two code blocks where user input is required. • Implement a do-while loop in both blocks of code to ensure that input is valid and any exceptions are handled. • Use the two following sample sets of input to test your program.…arrow_forward
- Problem: Kindly please add comments to my program thank you very much!package examples;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.*;public class dateSortListr {public static void main(String[] args) throws ParseException{Scanner s=new Scanner (System.in);Date date[];String str[];System.out.print("Enter number of dates: ");// Integer inputint i,n = s.nextInt();str= new String[n];date = new Date[n];s.nextLine();System.out.println("\nEnter dates using dd-MM-yy format");for(i=0;i<n;i++){str[i]=s.next();}SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");for (i=0;i<n;i++){date[i]=sdf.parse(str[i]);}Arrays.sort(date);System.out.println("\nSorted Dates:");for (Date date1: date){System.out.println(sdf.format(date1));}}}arrow_forwardI have this code: import java.util.Scanner; public class CalcTax { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // Welcome message System.out.println("Welcome to my tax calculation program."); // Declare the variables int i, pinCode, maxRetries = 3; String choice; // Get the PIN code for (i = 0; i < maxRetries; i++) { System.out.print("Please enter the PIN code: "); pinCode = sc.nextInt(); if (pinCode == 5678) { break; } System.out.println("Invalid pin code. Please try again."); } if (i == maxRetries) { System.out.println("Invalid pin code. You have reached the maximum number of retries."); System.exit(0); } // Get the income, interest, deduction, and paid tax amount double income, interest, deduction, paidTax; do { System.out.print("Please…arrow_forwardimport java.util.Scanner; public class TicketCounter { public static void main (String [] args) { int awardPoints; int userTickets; Scanner scnr = new Scanner(System.in); userTickets = scnr.nextInt(); // Program will be tested with values: 5, 6, 7, 8. if (userTickets < 6) { awardPoints = 1; { else { awardPoints = userTickets; } System.out.println(awardPoints); }}arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY