INSTRUCTIONS (Visual Basics) Write a program that prompts the user for different
ID: 3669046 • Letter: I
Question
INSTRUCTIONS (Visual Basics)
Write a program that prompts the user for different pieces of information, performs various calculations, and displays the requested results on the screen as indicated by each set of instructions.
Problem #1
Ask the user for the radius of a circle and calculate the area and circumference of the circle. Display the results on the screen. Make sure you program can handle both integer and decimal inputs.
Use the following formula(s) to assist you in your calculations: Area = pi * radius2
Circumference = 2 * pi * radius
Problem #2
Ask the user for the base and height of a right triangle and calculate the area and perimeter of the triangle. Display the results on the screen. sure your program can handle both integer and decimal inputs.
Use the following formula(s) to assist you in your calculations: Area = (1/2) * base * height
Opposite_Side2 + Adjacent_Side2 = Hypotenuse2 (for right triangles)
Problem #3
Ask the user for a principle amount, interest rate, compound frequency (per year), and number of years and determine the amount of money that would exist in an account given the compound interest accumulation for the provided parameters. Display the results on the screen and make sure you program can handle both integer and decimal inputs.
Use the following formula(s) to assist you in your calculations:
Amount_In_Account = Principle * (1 + (Rate / Annual_Compound_Frequency))^(Annual_Compound_Frequency * Years_Elapsed)
Remember to round your figures to something reasonable. For questions 1 and 2, use 3 points of precision after the decimal points. For problem #3, use the currency formatting features of Console.Write() and Cosole.WriteLine() to display the results. Make your program output attractive.
THANK YOU
Explanation / Answer
Problem 1
using System;
class Cirlce{
public static void Main(){
Console.WriteLine("Enter the radius of the Circle : ");
double rad;
if (double.TryParse(Console.ReadLine(), out rad)){
Console.WriteLine("Circumference of Circle is : "+2*Math.PI*rad+' ');
Console.WriteLine("Area of Circle is : "+Math.PI*rad*rad+' ');
}
}
}
Problem 2:
using System;
class Triangle{
public static void Main(){
Console.WriteLine("Enter the base of the Triangle : ");
double b;
if (double.TryParse(Console.ReadLine(), out b)){
double h;
if (double.TryParse(Console.ReadLine(), out h)){
Console.WriteLine("Area of Triangle is : "+0.5*b*h+' ');
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.