Absolute Java (6th Edition)
Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 9PP

(This is a better version of an exercise from Chapter 1.) Write a program that reads in a line of text and then outputs that line of text with the first occurrence of "hate" changed to "love". For example, a possible sample dialogue might be the following:

Enter a line of text . I hate you . I have rephrased that line to read: I love you .

You can assume that the word "hate" occurs in the input. If the word "hate" occurs more than once in the line, your program should replace only the first occurrence of "hate".

Blurred answer
Students have asked these similar questions
Write a program that asks the user how many credit units they have taken. If they have taken 23 or less, print that the student is a freshman. If they have taken between 24 and 53, print that they are a sophomore. The range for juniors is 54 to 83, and for seniors it is 84 and over.
] In a triangle, the sum of the lengths of any two sides is greater than the lengthof the other third side. Write a program triangle.cc that prompts a user to enterthe lengths of three sides, checks if they form a triangle, and outputs if it is an isosceles,equilateral, scalene, or right triangle. Also, your program should output the perimeter andthe area of the triangle. In a right triangle, the square of the length of one side is equalto the sum of the squares of the lengths of the other two sides. An isosceles triangle hastwo sides of equal length. An equilateral triangle has all three sides with the same length.A scalene triangle has no equal sides. Your program should define and use the followingfunctions:(a) isTriangle - takes the 3 sides of a triangle and returns true if they form a triangle,false otherwise.(b) isIsosceles - takes the 3 sides of a triangle and returns true if they form anisosceles triangle, false otherwise.(c) isEquilateral - takes the 3 sides of a triangle and…
Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is:

Chapter 2 Solutions

Absolute Java (6th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY