0
Java do while loop
please help me with this question. I want to write a code for that. https://uncg.instructure.com/courses/95088/files/9435428/download
12 Answers
+ 1
https://code.sololearn.com/c6lX3bpj1Iu4
Keep learning & happy coding :D
+ 1
We can't access that link. Please show your attempts.
+ 1
Your problem is just simple u have mentioned two languages java and JavaScript i suppose u know well the difference between java and js.
Come to your question in java
First create a menus how will u do that Use system.out.print statement then
u need to calculate area of different different shapes declear some variables and use formula. if u know how to create function then divide your program into 3 function and call all of them using switch case .
+ 1
here are some examples of console menu with while() loop for inspiration
https://www.codegrepper.com/code-examples/java/how+to+make+a+java+main+menu+loop+after+using+a+case
+ 1
Thank you so much I really appreciate it
0
it requires login
0
Oh ok 1 min
0
SAMPLE RUN SCREEN
Values shown in bolded blue are variables.
Lab Seven
Christine Kikuchi
CSC 130, Sec #
This program will show the user a menu that allows him to have
the program calculate the area of a square, rectangle, or circle.
The menu is in a loop so the user may use it as often as he wishes.
The code for the calculations is in methods called by main.
************************************************************
Menu
1 - Square
2 - Rectangle
3 - Circle
4 - Quit the program
************************************************************
Please make your choice from the menu: 0
Invalid choice. Please select 1, 2, 3, or 4. 5
Invalid choice. Please select 1, 2, 3, or 4. 15
Invalid choice. Please select 1, 2, 3, or 4. -98
Invalid choice. Please select 1, 2, 3, or 4. 2
What is the length of the rectangle? 2
What is the width of the rectangle? 3
The area of the rectangle is 6.00
0
Objectives:
To create a module-based program
To create methods
To call methods.
Note: This lab will cover concepts from Chapter Six, Sections 6.1-6.8. You will not use any material from
Sections 6.7-6.11.
Assignment:
You will create a new program called LastNameFirstInitialLab7.
Add the necessary import statement(s), and the comments for the integrity statement, lab number, and
programmer name and course name in the correct places. As always, it must also print out the lab #,
programmer's name, course name and section #, and the program information.
The program will show a user a menu that allows him or her to have the program calculate the area of a square,
rectangle, or circle. The menu is in a loop so the user may use it as often as he wishes. The code for the
calculations is in methods called by main.
If the user chooses 1, then the program will call the method called squareArea. This method will ask the user to
enter the length of one side of the square. The program will then calculate the area of a square.
The formula is area = side * side
If the user chooses 2, then the program will call the method called rectangleArea. This method will ask the
user to enter the length of the rectangle and then to enter the width of the rectangle. The program will then
calculate the area of a rectangle.
The formula is area = length * width
If the user chooses 3, then the program will call the method called circleArea. This method will ask the user to
enter the radius of the circle. The program will then calculate the area of a circle.
The formula is area = PI * radius * radius.
Note: In order to use PI, the identifier PI will need to de defined as a constant with the value of PI =
3.14159. Typically, so that any part of a program can access a constant, it will be declared in between
the class header and the main method. The declaration will be:
static final double PI = 3.14159;
Choice 4 will quit the program. Before it quits, it will say, "Thank you for using my program!" You may write
this cod
0
ok, but we need to see your code
0
I don't have it I need help with it
0
do while loop is sn exit control loop
It is ment for menu driven programming
It will execute statements atleast once with indepence of condition
It will ends with semi colon
So it is called statement