**This program is to be created using Visual Studio C#**Create as a Windows Form application**
1. Output a header in the console: "Program 1"
2. Next you will ask the user to enter three floats and read the
values into variables.
3. Perform addition, multiplication, and division examples with the
numbers entered.
4. Implicitly cast the floats into doubles.
5. Explicitly cast the floats into ints.
6. Use conversion methods to convert the floats into strings.
7. Ask the user to enter one of four string choices and demonstrate
a switch statement based on the string entered by the user.
8. Use decision constructs to sort the items into ascending
order
- Use existing floats from #2
- Must accommodate any entry order and sort correctly
- Do not use the Sort () method
9. Output a thank you message: “Thank you for running Program
1.”
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
NOTE : FOR THIS KIND OF EXERCISE CONSOLE APPLICATION IS BEST SUITED HENCE USED CONSOLE APPLICATION INSTEAD OF WINDOWS FORMS APPLICATION.
Here a new console Application in C# is created using Visual Studio 2017 with name "ConsoleApps".This application contains a class with name "Program.cs".Below are the details of this class.
Program.cs :
//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//app,ication namespace
namespace ConsoleApps
{
class Program //program
{
//Main method
static void Main(string[] args)
{
//1. Output a header in the console: "Program 1"
Console.WriteLine("Program 1");
//2. Next you will ask the user to enter three floats and read the
values into variables.
//asking user to enter three number
Console.Write("Enter Number 1 : ");
float num1 = float.Parse(Console.ReadLine());//reading number
Console.Write("Enter Number 2 : ");//asking to enter second
number
float num2 = float.Parse(Console.ReadLine());//reading number
Console.Write("Enter Number 3 : ");//asking to enter third
number
float num3 = float.Parse(Console.ReadLine());//reading number
//calculate and display addition of three numbers
Console.WriteLine($"Addition of {num1},{num2} and {num3} :
{num1+num2+num3}");
//calculate and display multiplication of three numbers
Console.WriteLine($"Multiplication of {num1},{num2} and {num3} :
{num1 * num2 * num3}");
//calculate and display average of three numbers
Console.WriteLine($"Average of {num1},{num2} and {num3} : {(num1 +
num2 + num3)/3}");
//4. Implicitly cast the floats into doubles.
Console.WriteLine("---------Numbers in doubles --------- ");
double num4 = num1;
double num5 = num2;
double num6 = num3;
//display numbers in doubles
Console.WriteLine($"Number in Doubles {num4},{num5} and
{num6}");
//5. Explicitly cast the floats into ints.
Console.WriteLine("---------Numbers in ints --------- ");
int num7 = Convert.ToInt32(num1);
int num8 = Convert.ToInt32(num2);
int num9 = Convert.ToInt32(num3);
//display numbers in INTEGERS
Console.WriteLine($"Number in integers {num7},{num8} and
{num9}");
//6. Use conversion methods to convert the floats into
strings.
Console.WriteLine("---------Numbers in Strings --------- ");
string s1 = Convert.ToString(num1);
string s2 = Convert.ToString(num2);
string s3 = Convert.ToString(num3);
//display numbers in strings
Console.WriteLine($"Number in strings {s1},{s2} and {s3}");
//7. Ask the user to enter one of four string choices and
demonstrate a switch statement based on the string entered by the
user.
Console.WriteLine("Enter Welcome,Inspirational,Thanks and Good
bye");
//reading message
string msg = Console.ReadLine();
//passing string to switch
switch (msg)
{
case "Welcome": Console.WriteLine("Welcome to my World");
break;
case "Inspirational": Console.WriteLine("My Inspirational
World");
break;
case "Thanks": Console.WriteLine("Thanks for the visit");
break;
case "Good Bye": Console.WriteLine("Good Bye");
break;
default:
Console.WriteLine("Invalid choice");
break;
}
//8. Use decision constructs to sort the items into ascending
order
//-Use existing floats from #2
//- Must accommodate any entry order and sort correctly
//- Do not use the Sort() method
float big=0, small=0, middle=0;
if (num1 > num2 && num1 > num3)
{
big = num1;
if (num2 > num3)
{
middle = num2;
small = num3;
}
else
{
middle = num3;
small = num2;
}
}
else if(num2>num1 && num2 > num3)
{
big = num2;
if (num1 > num3)
{
middle = num1;
small = num3;
}
else
{
middle = num3;
small = num1;
}
}
else if (num3 > num1 && num3 > num2)
{
big = num3;
if (num1 > num2)
{
middle = num1;
small = num2;
}
else
{
middle = num2;
small = num1;
}
}
Console.WriteLine("-----------Sorted numbers
are--------------------");
Console.WriteLine($"{big},{middle},{small}");
//9.Output a thank you message: “Thank you for running Program
1.”
Console.WriteLine("Thank you for running Program 1.");
}
}
}
======================================================
Output : Run application using F5 and will get the screen as shown below
Screen 1 :
Screen 2 :Screen for another set of numbers
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
**This program is to be created using Visual Studio C#**Create as a Windows Form application** 1....
**This program is to be created using Visual Studio C#**Create as a Windows Form application** 1. Output a header in the console: “This is a replacement program” 1. Output a header that states: “This is Program 5” 2. Output a thank you message: “Thank you for running the program.”
This is with microsoft studio visual basic Sorted Names Design a program that allows the user to enter 20 names into a String array. Sort the array in ascending (alphabetical) order and display its contents.
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
This C++ Programs should be written in Visual studio 2017 PROGRAM 1: Comparing Using Arrays to Using Individual Variables One of the main advantages of using arrays instead of individual variables to store values is that the program code becomes much smaller. Write two versions of a program, one using arrays to hold the input values, and one using individual variables to hold the input values. The programs should ask the user to enter 10 integer values, and then it...
how to make this program for c++ visual studio 2015. Also, can I
show your working and program. Also, Can you have notice for pseudo
code?
For the first problem, please implement Problem 4 on page 142 (p 143, 7E) of the text. A scan of the problem is provided below. This problem asks you to calculate the average rainfall for three months. The program should ask the user to enter the name of each month, such as June or...
Description -- Microsoft Studio, Visual Basic Problem 6.1 Words Reversed - Write a program that uses a Do Loop so that the user may enter words using a popup Input Box. Once the user enters "STOP" , the program then displays all the words in a single string. The difficulty is that the words are displayed in reverse order with spaces. The program is initiated with a button. For example: The following words are entered separately one at a time:...
This program should be run on Visual Studio. Please use printf
and scanf as input and output. Thank you
6.11 Lab Exercise Ch.6a: Functions: String analyzer Create and debug this program in Visual Studio. Upload your Source.cpp file for testing (1) Prompt the user to enter a string of their choosing. Output the string. (1 pt) Ex: ics Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have...
Programming question. Using Visual Studio 2019 C#
Windows Form Application (.NET Framework)
Please include code for program with ALL conditions met.
Conditions to be met:
Word Problem A person inherits a large amount of money. The person wants to invest it. He also has to withdraw it annually. How many years will it take him/her to spend all of the investment that earns at a 7% annual interest rate? Note that he/she needs to withdraw $40,000.00 a year. Also there...
Recursion program
C++. Visual Studio Win 32 console application
that has user loop. The Design a computer program a executes the program, should do the following. computer, as it 1) The computer should politely ask the user for two input integers m and n. There should be code to make sure that m <-n 2) Then there should be a recursive function, called LargestToSmallestO that is invoked to output all the values from n downto m. 3) Then there should...
C programing Write a program to sort numbers in either descending or ascending order. The program should ask the user to enter positive integer numbers one at a time(hiting the enter key after each one) The last number entered by the user should be -1, to indicate no further numbers will be entered. Store the numbers in an array, and then ask the user how to sort the numbers (either descending or ascending). Call a function void sortnumbers ( int...