Write a program that reads from the user a character ('q' or 'c'). if the character is 'c', the program reads from the user the radius rof a circle and prints its area. • If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. • Otherwise, it prints "Wrong character" PS: Use the following formulas: area of circle=3.14*r Sample Run1: Enter a character (q or c): q Enter the Length and Width: 80 150 It is a rectang le Sample Run2: Enter a character (q or c): q Enter the Length and Width: 80 80 It is a square Sample Run3: Enter a character (q or c): c Enter the radius: 2 The area of the circle is 12.56 Sample Run4: Enter a character (q or c): d Wrong character

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter4: Making Decisions
Section: Chapter Questions
Problem 7E: Write a program named GuessingGame that generates a random number between 1 and 10. (In other words,...
icon
Related questions
Question

write the program using java

 

Write a program that reads from the user a character ('q' or 'c').
If the character is 'c', the program reads from the user the radius rof a circle and prints its area.
• If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We
assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square
or rectangle.
• Otherwise, it prints "Wrong character"
PS: Use the following formulas:
area of circle=3.14*r
Sample Run1:
Enter a character (q or c): q
Enter the Length and Width: 80 150
|It is a rectangle
Sample Run2:
Enter a character (q or c): q
Enter the Length and Width: 80 80
It is a square
Sample Run3:
Enter a character (q or c): c
Enter the radius: 2
The area of the circle is 12.56
Sample Run4:
Enter a character (q or c): d
Wrong character
Transcribed Image Text:Write a program that reads from the user a character ('q' or 'c'). If the character is 'c', the program reads from the user the radius rof a circle and prints its area. • If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. • Otherwise, it prints "Wrong character" PS: Use the following formulas: area of circle=3.14*r Sample Run1: Enter a character (q or c): q Enter the Length and Width: 80 150 |It is a rectangle Sample Run2: Enter a character (q or c): q Enter the Length and Width: 80 80 It is a square Sample Run3: Enter a character (q or c): c Enter the radius: 2 The area of the circle is 12.56 Sample Run4: Enter a character (q or c): d Wrong character
Expert Solution
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Files and Directory
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,