Suppose you are writing a program that asks the user to give a yes-or-no response. Assume that
Question:
Suppose you are writing a program that asks the user to give a yes-or-no response. Assume that the program reads the user’s response into the Stringvariableresponse.
a. If response is yes or y, set the boolean variable accept to true; otherwise, set it to false.
b. How would you change the code so that it will also accept Yes and Y?
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 76% (13 reviews)
a if responseequalsy responseequalsyes accept true else accept false ...View the full answer
Answered By
Joseph Njoroge
I am a professional tutor with more than six years of experience. I have helped thousands of students to achieve their academic goals. My primary objectives as a tutor is to ensure that students do not have problems while tackling their academic problems.
4.90+
10+ Reviews
27+ Question Solved
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Question Posted:
Students also viewed these Computer science questions
-
In this assignment, you are writing a program that converts common texting abbreviations to English words to allow people like yours truly can understand. For the assignment, you are provided with a...
-
using Mobaxterm Write a program that asks the user to give his/her birth date and calculate the following: How old is the user (in years). How old is the user (in months). In how many days the...
-
Write a program that asks the user to think of an integer between 1 and 1,000,000, and then guesses the number through a series of yes/no questions. To guess the number, the program calls a recursive...
-
In the OKR goal-setting framework, what is the difference between objectives and key results? Objectives deal with measurable aspects of a company's processes, while key results deal with...
-
Acetylene gas (C2H2) is burned completely with 20 percent excess air during a steady-flow combustion process. The fuel and the air enter the combustion chamber separately at 25oC and 1 atm, and heat...
-
MBA Inc is expected to have dividend distribution policies as below: - MBA Inc will pay out cash dividend 1 per share per year in the next two years - In the end of the 3rd year, MBA Inc will pay out...
-
What do you mean by petty cash book? Explain the different forms of petty cash book.
-
Siberian Ski Company recently expanded its manufacturing capacity, which will allow it to produce up to 15,000 pairs of cross-country skis of the mountaineering model or the touring model. The sales...
-
Part A: Case study - Gousto Part A of this TMA will be marked out of 80 marks. Your answer to this question should be no more than 1000 words. Read the case study and answer the following questions:...
-
Fortune magazine's list of the world's most admired companies for 2014 is provided the data contained in the WEB file named Admired Companies (Fortune, March 17, 2014). The data in the column...
-
Repeat any of the previous Practice Programs using JOptionPane, which is described in the graphics supplement at the end of Chapter 2.
-
Suppose that we are working for an online service that provides a bulletin board for its users. We would like to give our users the option of filtering out profanity. Suppose that we consider the...
-
A 2.0-cm-diameter spider is 2.0 m from a wall. Determine the focal length and position (measured from the wall) of a lens that will make a half-size image of the spider on the wall.
-
Convex Productions produces full-length motion pictures for distribution worldwide. Convex has just purchased the rights to a movie script entitled Native Sun, which it intends to develop as its next...
-
You are visiting the Engineering Office of Denton Hospital, as part of a consulting project. You notice some charts on one wall which look familiar to you: One of the employees notices you reading...
-
Richmond Clinic has obtained the following estimates for its costs of debt and equity at different capital structures: What is the firms optimal capital structure? (Hint: Calculate its corporate cost...
-
Suppose a sample yields estimates \(\widehat{\theta}_{1}=5, \widehat{\theta}_{2}=3\), se \(\left[\widehat{\theta}_{1} ight]=2\), and se \(\left[\widehat{\theta}_{2} ight]=1\) and the correlation...
-
Helium expands in a nozzle from \(0.8 \mathrm{MPa}, 500 \mathrm{~K}\), and negligible velocity to \(0.1 \mathrm{MPa}\). Calculate the throat and exit areas for a mass flow rate of \(0.34 \mathrm{~kg}...
-
Perform the multiplication or division indicated in each of the following expressions and collect the like terms. 6a 2 b/- 2ab 2
-
Define cultural intelligence. Cite the books or journal articles you found in Capella's library. Explain why cultural intelligence is important for HR practitioners and other organizational managers.
-
Calculate the product of 8.0546875 10 0 and -1.79931640625 10 1 by hand, assuming A and B are stored in the 16-bit half precision format described in Exercise 3.27. Assume 1 guard, 1 round bit, and...
-
Calculate by hand 8.625 10 1 divided by -4.875 10 0 . Show all the steps necessary to achieve your answer. Assume there is a guard, a round bit, and a sticky bit, and use them if necessary. Write...
-
Calculate (3.984375 10 - 1 + 3.4375 10 -1 ) + 1.771 10 3 by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and also described in the...
-
5. Which of the following is the cheapest for a borrower? a. 6.7% annual money market basis b. 6.7% semi-annual money market basis c. 6.7% annual bond basis d. 6.7% semi-annual bond basis.
-
Waterloo Industries pays 30 percent corporate income taxes, and its after-tax MARR is 24 percent. A project has a before-tax IRR of 26 percent. Should the project be approved? What would your...
-
Imagine you are an Investor in the Stock Market. Identify three companies in the Korean Stock Market (KOSPI) where you would like to invest. Explain your answer
Study smarter with the SolutionInn App