Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Program Divisible Program Write a program that reads two integer values x and y, computes the remainder, and determines whether x is divisible by

Java Program

Divisible Program Write a program that reads two integer values x and y, computes the remainder, and determines whether x is divisible by y. The following are examples of running the program. The examples illustrate the messages to use to read data and the messages to display when x is divisible by y, and when it is not divisible by y.

 Enter x: 8 Enter y: 3 Remainder: 2 8 is NOT divisible by 3 Enter x: 8 Enter y: 4 Remainder: 0 8 is divisible by 4 ColorGenerator Program  Write a program that computes a CSS color. We define a CSS color as a string that starts with a # character and it is followed by three pairs of 2 characters. The possible pairs of two characters will be 00 or FF. A color is defined by two characters for red, two characters for green, and two characters for blue. For example, #FF0000 is just red, whereas #00FFFF is the combination of green and blue. Your program will ask users whether they want to have red as part of the CSS color. If the user answers "Yes", FF will be used for the red component; otherwise 00 will be used. The program will then ask the user whether they want both green and blue in the CSS color. If the user answers "Yes", FFFF will be used for green and blue; otherwise 0000 will be used. As you can see not all possible color choices can be generated (e.g., #FF00FF). The following are examples of running the program. The examples illustrate the messages to use when reading data and displaying the result. Notice that in addition to use "Yes", users can use "Yeah" to accept a choice. Any other value entered is considered a "No" choice.
 Do you want red? (Yes/Yeah/No): Yes Do you want green and blue? (Yes/Yeah/No): No Final Color: #FF0000 Do you want red? (Yes/Yeah/No): No Do you want green and blue? (Yes/Yeah/No): Yes Final Color: #00FFFF

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago