Starting Out with Java: From Control Structures through Objects (6th Edition)
6th Edition
ISBN: 9780133957051
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 13MC
You can use this class to display dialog boxes.
- a. JOptionPane
- b. BufferedReader
- c. InputStreamReader
- d. DialogBox
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule03:43
Students have asked these similar questions
This is my code till now.please modify this code to print the output.
#include<iostream>
using namespace std;
class Device
{
public:
string description;
Device()
{
description="Floppy Disk";
cout<<"I'm a Device constructor"<< endl;
};
~Device(){
cout<<"I'm a Device destructor"<<endl;
};
};
class Headphones:public Device{
void play(){
cout<<"Play Music"<<endl;
}
void device_type(){
string headphones;
string color="black";
}
std::string get_color(color)
{
return(color);
}
};
class Microphone: private Device{
void record(){
cout<<"Record voice"<<endl;
string device_type="microphone";
}
};
class headphones_with_microphone: public Headphones, public Microphone {
std::Get_device_type(){
return device_type;
}
};
class Output: headphones_with_microphone
{
void print_out(){
return(description);
play();
record();
Get_device_type();
}
};
int main() {
Output obj;
obj.print_out();
return0;
}
What is the benefit of using an Open and/or Save As dialog box in an application that works with files?
What will the following code display in the lblSum control?
Dim intSum As Integer
Dim intY As Integer
Do While intY < 3
For intX As Integer = 1 To 4
intSum = intSum + intX
Next intX
intY = intY + 1
Loop
lblSum.Text = Convert.ToString(intSum)
Chapter 2 Solutions
Starting Out with Java: From Control Structures through Objects (6th Edition)
Ch. 2.1 - The following program will not compile because the...Ch. 2.1 - When the program in Question 2.1 is saved to a...Ch. 2.1 - Complete the following program skeleton so it...Ch. 2.1 - On paper, write a program that will display your...Ch. 2.1 - Prob. 2.5CPCh. 2.1 - Every Java application program must have...Ch. 2.2 - The following program will not compile because the...Ch. 2.2 - Study the following program and show what it will...Ch. 2.2 - On paper, write a program that will display your...Ch. 2.3 - Examine the following program. // This program...
Ch. 2.3 - What will the following program display on the...Ch. 2.4 - Which of the following are illegal variable names...Ch. 2.4 - Prob. 2.13CPCh. 2.4 - Prob. 2.14CPCh. 2.4 - Prob. 2.15CPCh. 2.4 - A program declares a float variable named number,...Ch. 2.4 - Prob. 2.17CPCh. 2.4 - Prob. 2.18CPCh. 2.4 - Prob. 2.19CPCh. 2.4 - Prob. 2.20CPCh. 2.4 - What is wrong with the following statement? char...Ch. 2.5 - Prob. 2.22CPCh. 2.5 - Prob. 2.23CPCh. 2.6 - Write statements using combined assignment...Ch. 2.7 - The following declaration appears in a program:...Ch. 2.7 - The variable a is a float and the variable b is a...Ch. 2.9 - Write a statement that declares a String variable...Ch. 2.9 - Assume that stringLength is an int variable. Write...Ch. 2.9 - Prob. 2.29CPCh. 2.9 - Prob. 2.30CPCh. 2.9 - Prob. 2.31CPCh. 2.11 - Prob. 2.32CPCh. 2.11 - How are documentation comments different from...Ch. 2.14 - Prob. 2.34CPCh. 2.14 - Write code that will display each of the dialog...Ch. 2.14 - Write code that displays an input dialog asking...Ch. 2.14 - Prob. 2.37CPCh. 2 - Every complete statement ends with a __________....Ch. 2 - The following data 72 'A' Hello World 2.8712 are...Ch. 2 - A group of statements, such as the contents of a...Ch. 2 - Which of the following are not valid assignment...Ch. 2 - Which of the following are nor valid println...Ch. 2 - The negation operator is __________. a. unary b....Ch. 2 - This key word is used to declare a named constant....Ch. 2 - These characters mark the beginning of a...Ch. 2 - These characters mark the beginning of a...Ch. 2 - These characters mark the beginning of a...Ch. 2 - Which Scanner class method would you use to read a...Ch. 2 - Which Scanner class method would you use to read a...Ch. 2 - You can use this class to display dialog boxes. a....Ch. 2 - Prob. 14MCCh. 2 - Prob. 15MCCh. 2 - True or False: A left brace in a Java program is...Ch. 2 - True or False: A variable must be declared before...Ch. 2 - True or False: Variable names may begin with a...Ch. 2 - True or False: You cannot change the value of a...Ch. 2 - True or False: Comments that begin with / / can be...Ch. 2 - True or False: If one of an operators operands is...Ch. 2 - What will the following code segments print on the...Ch. 2 - int x = 0, y=2; x = y 4; System.out.println(x +...Ch. 2 - System.out.print(I am the incredible);...Ch. 2 - System.out.print(Be careful\n);...Ch. 2 - int a, x = 23; a = x % 2; System.out.println(x +...Ch. 2 - Find the Error There are a number of syntax errors...Ch. 2 - Show how the double variables temp, weight, and...Ch. 2 - Prob. 2AWCh. 2 - Write assignment statements that perform the...Ch. 2 - Assume the variables result, w, x, y, and z are...Ch. 2 - Prob. 5AWCh. 2 - Modify the following program so it prints two...Ch. 2 - What will the following code output? int apples =...Ch. 2 - What will the following code output? double d =...Ch. 2 - What will the following code output? String...Ch. 2 - What will the following code output? String...Ch. 2 - Convert the following pseudocode to Java code. Be...Ch. 2 - Prob. 12AWCh. 2 - Write the code to set up all the necessary objects...Ch. 2 - Prob. 14AWCh. 2 - A program has a float variable named total and a...Ch. 2 - Is the following comment a single-line style...Ch. 2 - Is the following comment a single-line style...Ch. 2 - Describe what the phrase self-documenting program...Ch. 2 - Prob. 4SACh. 2 - Prob. 5SACh. 2 - What does a variable declaration tell the Java...Ch. 2 - Prob. 7SACh. 2 - What things must be considered when deciding on a...Ch. 2 - Briefly describe the difference between variable...Ch. 2 - What is the difference between comments that start...Ch. 2 - Briefly describe what programming style means. Why...Ch. 2 - Assume that a program uses the named constant PI...Ch. 2 - Assume the file Sales Average, java is a Java...Ch. 2 - Prob. 14SACh. 2 - Name, Age, and Annual Income Write a program that...Ch. 2 - Name and Initials Write a program that has the...Ch. 2 - Personal Information Write a program that displays...Ch. 2 - Star Pattern Write a program that displays the...Ch. 2 - Sales Prediction The East Coast sales division of...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Sales Tax Write a program that will ask the user...Ch. 2 - Cookie Calories A bag of cookies holds 40 cookies....Ch. 2 - Miles-per-Gallon A cars miles-per-gallon (MPG) can...Ch. 2 - Test Average Write a program that asks the user to...Ch. 2 - Circuit Board Profit An electronics company sells...Ch. 2 - Prob. 12PCCh. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Male and Female Percentages Write a program that...Ch. 2 - Stock Commission Kathryn bought 600 shares of...Ch. 2 - Energy Drink Consumption A soft drink company...Ch. 2 - Ingredient Adjuster A cookie recipe calls for the...Ch. 2 - Word Game Write a program that plays a word game...Ch. 2 - Stock Transaction Program Last month Joe purchased...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Summarize the difference between a program and a process.
Computer Science: An Overview (12th Edition)
(Multiples of 2 with an Infinite Loop) Write a program that keeps printing the multiples of the integer 2, name...
C How to Program (8th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
What is the difference between a program written in a high-level language, a program in machine language, and a...
Java: An Introduction to Problem Solving and Programming (8th Edition)
Angle Calculator Write a program that asks the user for an angle, entered in radians. The program should then d...
Starting Out with C++: Early Objects
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
- Flowchart that converts temperature (Fahrenheit to Celsius, and vice versa)arrow_forwardcan you design flowchart for this code : from time import sleepfrom os import systemfrom gpiozero import Button, LEDled = LED(4)button = Button(26)while True: if button.is_pressed:print("BUZZZZZZ")led.on()system("aplay buzzer.wav &")sleep(1)led.off()arrow_forward(True/False): Win32 console input functions can detect when the user has resized the console window.arrow_forward
- in visual basics. (1) The following program asks the user for two numbers and then outputs the total. Create this program in the console. Dim vNum As Integer Dim vTot As Integer For vNum = 0 To 1 Console.WriteLine(“Enter a number?”) vTot= vTot+ Val(Console.Readline()) Next Console.WriteLine(“The total is “ & vTot) (2) Use the For next loop to make sums. Create a console application and use the following code. Dim vNum As Integer Dim vTot As Integer = 0 For vNum = 0 To 10 vTot = vTot + vNum Next Console.WriteLine(vTot) (3) Use the following code to make a table in the console. Call the application Simple Table Dim vCol As Integer Dim vRow as Integer Dim vLine As String For vCol =0 To 5 vLine = “” For vRow =0 To 4 vLine = vLine & “x “ Next Console.WriteLine(vLine) Next (4) Modify the above code to print out a consecutive series of numbers. Eg 1 2 3 4 5 6 7 8 (5) In the space below using a For next loop…arrow_forwardWhat will the following code display in the lblSum control? Dim intSum As Integer Dim intY As Integer Do While intY < 3 For intX As Integer = 1 To 4 intSum += intX Next intX intY += 1 Loop lblSum.Text = intSum.ToString a. 5 b. 8 c. 15 d. 30arrow_forwardState whether it is true or false. If the answer is false, explain why? " The cin stream normally is connected to the display screen. "arrow_forward
- In the code below, why is it that the displayName() module cannot print the person’s name?Start Call getInput() Call displayName()StopModule getInput() Declare String name Display "Enter your name: " Input nameEnd ModuleModule displayName() Display "Your name is: " + nameEnd Modulearrow_forwardThe C# method that produces a line of output on the screen and then positions the cursor on the next line is __________. a. WriteLine() b. printLine() c. DisplayLine() d. OutLine()arrow_forwardC# windows form Application. 1. Add these specific colors Red, Blue, Green, Yellow in the combobox. 2.When only the Color Red is selected in the combobox allow for the Red checkbox to be checked and the Blue checkbox to be checked automatically and I want the output to say Red&Blue in the text file once the save button is clicked. . 3. But lets say I wanted to manually uncheck the Blue checkbox now once I click save instead of Red&Blue being output it just Red in the text file. Please I need help creating that functionality that I explained .arrow_forward
- Topic: Binary Fill in the boxes Will give you high rating thank you!!arrow_forwardUse timer event to write a simple game to be played in a JFrame. One of your pictures is jumpingin the frame, showing up in randomly selected places. Whenever the user catches the picture withmouse, the picture will stop moving. When the user releases the mouse, the picture will continueto jump. You should allow users to choose the jumping speed. Each time the jumping picture isclicked, it is switched to a different picture with soundarrow_forwardRest of code in image / This is a bad programming style since it is using goto. // This is an spagetti code and not working.// Use function to display menu, and display game rules,// Use different color for text display.// fix it so it works any way you like./*HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // Write 16 lines in 16 different colors. for (int color = 0; color < 16; color++) { SetConsoleTextAttribute (screen, color); cout << " Hello World!" << endl; Sleep(400); // Pause between lines to watch them appear } // Restore the normal text color) SetConsoleTextAttribute(screen, 7);*/#include <iostream>#include <windows.h>using namespace std;int main(){ //textbackground(WHITE); //textcolor(RED); system("cls"); char ch, a[20], ch2; int num = 100, rnum, guess, count, ch1, c = 0; cout << "**********************************************************"<<endl; cout << "*…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License