Write a program to collect the input float point numbers x a

Write a program to collect the input float point numbers x and y by using Scanner, and then display the result of 3x + 2y^2/4x - 5y middot 8 + 6x/7 xy by using System out. Write a program to calculate the area of a circle. Your program should take a float point number radius from an input dialog. Then calculate the circle area (pi r^2) and show it in a message dialog.

Solution

//Calculating area of circle by taking input from input dialog and showing output on message dialog

import javax.swing.JOptionPane;
public class AreaCircle {
public static void main(String[] args) {
double rad, area;

int dialogType = JOptionPane.PLAIN_MESSAGE;
String input = JOptionPane.showInputDialog(null,
\"Enter radius \", \"circle area \",
dialogType);
rad = Double.parseDouble(input);
area = Math.PI * Math.pow(radius, 2);
String message = \"Area of Circle: \" + area;
String title = \"Circle Area Output\";
JOptionPane.showMessageDialog(null, message,
title, dialogType);
}
}

 Write a program to collect the input float point numbers x and y by using Scanner, and then display the result of 3x + 2y^2/4x - 5y middot 8 + 6x/7 xy by using

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site