Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
4th Edition
ISBN: 9780134787961
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 1FTE
Find the Error
There are a number of syntax errors in the following
*/ What’s wrong with this program? /*
public MyProgram
{
public static void main(String[] args);
}
int a, b, c \\ Three integers
a = 3
b = 4
c = a + b
System.out.println{'The value of c is' + C);
{
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Complete the program below that prints the sum of the integers from 1 to 10.
public class SumOf Integers {
public static void main(String[] args) {
/* Write your program here */
}
}
Don't copy from chegg or somewhere please already got copied incorrect answer.
Write a program in C++ which prints words of a string in reverse order for example if a user enter “I love programming ” it should print “ programming love I ” means if user enter something it can reverse user sentence.
Write a code snippet that can arrange the alphabets of a name entered by user in alternate cases .Note: Ignore white spaces . Implement this code in C language.
Input string: Timothy Olyphant
Output string: TiMoThY OLyPhAnT
Input string: Olga Kurylenko
Output string: OlGa KuRyLeNkO
Chapter 2 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Ch. 2.1 - Prob. 2.1CPCh. 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 - Prob. 6SACh. 2 - Prob. 7SACh. 2 - Prob. 8SACh. 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...Ch. 2 - Planting Grapevines A vineyard owner is planting...Ch. 2 - Compound Interest When a bank account pays...
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
- Computer Science Title: Programming - Practical Test 1 - SET 3Learning Objective:Write simple Java programs using basic data types, operators and expressions.Write Java programs using control structures - Sequence Question:Prepare a program that can read the price (RM) of two books. Calculate and print the total price (RM) of the two books that includes 5% discount.. Based on the given problem, the student need to:i. Write the Java programii. Display the output[100% marks] Sample input and output:Input price of book 1 : 50.50Input price of book 2 : 90.90Total price : 141.4Discount : 7.07Net paymant : 134.33 help me please asap.arrow_forwardNote:- Please type and execute this java program as soon as possible and also need an output for this java program. 1) This program counts the number of words in a sentence read from the keyboard Variables: String str; char ch; int x; int count = 0; int length; boolean charBeforeWasPunc = false; ask the user for a sentence read the sentence and store it in str get str length loop str from x = 0 to length { use charAt() and store the xth character in ch if ch is a punctuation, such as , or . or ; or ! or ‘ ‘(Note that this is a space char, an empty single quote increment count if charBeforeWasPunc is true { decerment count set charBeforeWasPunc to true } otherwise set charBeforeWasPunc false } if not charBeforeWasPunc is true increment count display countarrow_forwardThe following program have syntax errors. Correct them. On each successive line, assume that any preceeding error has been corrected. public class Exercise25{static final char = STAR = '*'static final int PRIME = 71;public static void main(String[] arg){count = 1;sum = count + PRIME;x := 25.67;newNum = count * ONE + 2;sum + count = sum;x = x + sum * COUNT;System.out.println("count = " + count + ", sum =" + sum + ", PRIME =" + Prime);}}arrow_forward
- Can you please explain how to cange the println statment to a printf statement and recive and an output other than 0.0 or infinity Thank you!! It is a recursion code: public class Main { public static void main(String[] args) { double result = division(10); System.out.println(result); } public static double division(double k) { if (k > 0) { return k /= division(k - 1); } else { return 0; } } }arrow_forwardCONVERT THIS CODE FROM JAVA TO C++ public class Tester { public static void main(String[] args) { //declare integers and arrays int leftindex=0, rightIndex=0, resultIndex=0; int n=10; int left[]=new int[n]; int right[]=new int[n]; int result[]=new int[2*n]; while(resultIndex<result.length) { //checks condition to enter loop if(leftindex>=left.length) { result[resultIndex]=right[rightIndex]; rightIndex++; resultIndex++; } else if(rightIndex>=right.length) { result[resultIndex]=left[leftindex]; leftindex++; resultIndex++; } else if(left[leftindex]<right[rightIndex]) { result[resultIndex]=left[leftindex]; leftindex++; resultIndex++; } else { result[resultIndex]=right[rightIndex]; rightIndex++; resultIndex++; } } } }arrow_forwardFix the mistakes in the following program so it runs as expected. There are 5 mistakes. All literals (such as 3.5) have the correct value and data type. // Java program by [Student name] [Today's date] public class Mistakes { public static void main(String[] args) { / This is a comment int z = 3.5; System.out.println("z is + z"); int s2 = "Michael"; System.out.println("s2 has the value " s2); } } Please show the mistakes clearly and how the change is made.arrow_forward
- In Java Write a program to reverse the string "Practice Makes Perfect" without using regex Output: Perfect Makes Practicearrow_forwardin java If b is 7 and c is 10, the value of c after the following statement is executed is _____. c *= b--;arrow_forwardUSE SCHEME IN DRRACKET.In the language of an alien race, all words take the form of Blurbs. A Blurb is a Whoozitfollowed by between zero or more Whatzits. A Whoozit is the character 'x' followed bybetween one or more 'y's. A Whatzit is a 'q' followed by either a 'z' or a 'd', followed by aWhoozit. -The program should ask the user to “Enter an alien word:”, read the inputas a string, and check whether or not it is a valid word (Blurb). If it is valid, it prints"The word is fine.", otherwise it prints "The word is a mess!". -The program should loop and ask the user for new input until they enter avalid blurb.For Scheme, it is suggested that you review the “input_and_output.rkt” sample program from the first module on functional programming. This program shows how to perform a “loop” that reads in data and processes it. You may find the following forms useful: a. (read) to read a string b. (string->list) to convert the string into a list of characters, c. (display “Hello”) to write…arrow_forward
- PROBLEM STATEMENT: Return the String "odd" if the input is odd otherwisereturn "even". public class CheckForEven{public static String solution(int number){// ↓↓↓↓ your code goes here ↓↓↓↓return null;}} please get help with this Java Questionarrow_forwardThe files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly // Makes String comparisonspublic class DebugSeven1{public static void main(String[] args){String name1 = "Roger";String name2 = "Roger";String name3 = "Stacy";if(name1.equals(name2))System.out.println(name1 + " and " + name2 +" are the same");if(name1.equals(name3))System.out.println(name1 + " and " + name2 +" are the same");if(name1.equals("roger));System.out.println(name1 + " and 'roger' are the same");if(name1.equals("Roger"));System.out.println(name1 + " and 'Roger' are the same");}}arrow_forwardPython Language Useful websites: : http://en.wikipedia.org/wiki/Radix http://www.purplemath.com/modules/numbbase.htm Special Rules: Use only Boolean/math expressions and conditional statements (if-statements). Do not use built-in functions for converting integers into a string representation. Here to start with: kthDigit(x: int, b: int, k: int) -> int .........arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Algebraic Expressions – Algebra Basics; Author: TabletClass Math;https://www.youtube.com/watch?v=U-7nq7OG18s;License: Standard YouTube License, CC-BY
Python Tutorial for Beginners 3 - Basic Math, Mathematical Operators and Python Expressions; Author: ProgrammingKnowledge;https://www.youtube.com/watch?v=Os4gZUI1ZlM;License: Standard Youtube License