Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help please CMPSCI111L Intro to Algorithms and Programming Java Lab Programming Project #2-User Input and Selections (30 points) Due 3/13/19 Create a NetBeans project named

Help please image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
CMPSCI111L Intro to Algorithms and Programming Java Lab Programming Project #2-User Input and Selections (30 points) Due 3/13/19 Create a NetBeans project named Projeet2. In Project2, create a main class with the name SumOfDigits. In the SumOfigits main0 method body, wrile a program hat prompts the user to enter an integer between 1 and 999 and adds all the digits in the integer. For example, if the user enters an integer 932, the sum of all ts digits is 9 +3+2-14. Use a sequence structure to solve this problem, DO NOT usea repetanon strucnire Hint: Use the % operator lo entract digitsandBethe / operator 10 remove the extracted digit. For instance 932 % ie-1(stracts the digit hes the number 932) and 932/10-93(oe the digit 2 from the number 932 , From the Project Navigatoe you can nan the new name and selecting 'Run File' or if the file is active in the NetBeans code oditor window, peess Shift FS. Here is a sample nus in Neteans Your peompt and final output must look similar to this program by right clicking on the file Enter an integer bet veen 1 and 999: 932 The sun of all digits in 932 is 14 Fiel D/lava%20Froyects/Proge02.pdf Book Cover okmarks D Degees &Peograms My QS decide" which Magic8-ball respoese to display. Here is what your progam's user prompt and final output must look like. Notice that the user's question st be repeated or "echoed back aftfer it is input What is your question? Will it snow tomor row? Your question vas: Will it snow tomorrow? My answer is: Outlook not so good. When you have completed all of the exercises, ZIP the entire project folder and upload this Z1P file to Canvas In NetBeans, click 'File', select Export Project" click To ZIP. " select the location where you want the Z1P file to be saved, then click the "Export' butorn If the IDE you are using does not have an you may have oly IPthe ino he projer iolds in fide hwr and option. Under called Finder which offers a Compress Foilder option bewser is called Windows Explorer and it offers a Send to wCompressed (zippod folder) option inder Windows, the file Book Cover Bookmarks Degrees&PrograesMyC-Se to Sengate Cen DO NOT create another project, we are going to add a new file to Project2. From the NetBeans File menu select New File. On the dialog box under File Type select Java Main Class and click Next. Create a main class with the name Magic8Ball, verify it is part of Project and click the 'Fimish buttion. In the MagicsBallmain( method body, write a program that simulates the popular children's decision-making toy called the Magic To do this, the program will first harve to prompt the user to enter his or her question the nextline () method on your Scanner-type object to obtain the entire line of text entered by the user Once the program has read the entire line of text entered by the user, the peogram shoulkd generate a random mumber between 0 and 19, which represents the 20 resposses which are possible for a Magic 8 Ball It is certain It is decidedly so eWithout a doubt Yes definitely . You mory rely on it As I see it yes Reply hary try again Ask apain later Better not tell you nw Cannot predict now Concentrate and ask again Don't count on it Most likely . My reply is no Outlook good My sources sary Oulook not so good Very doubtfu e Signs point to yes The program must generale this random number using the Math. random (1 method and should "store" the number in an in-type variable named random Number The program should then use a sclection feither nested if or switch structore)o

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

More Books

Students also viewed these Databases questions

Question

Challenges Facing Todays Organizations?

Answered: 1 week ago