Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Create a console application (core). In the console program's main function, write the C# code to do the following: Declare integer variable Y,

   

1. Create a console application (core). In the console program's main function, write the C# code to do the following: Declare integer variable Y, double variables X and Z, and string S. Initialize X to 2.0 and Z to 4.3 and S to "Enter a number: "as part of the declaration. Write S to the console, and then multiply X by a number entered by the user (read the number from the console) and store back in X. Then set Y equal to the following equation: Z+X 3* sin(X) + 14 Write the final values of X and Y to the console. Make sure to use a readline to pause the program before the console window closes. Following illustrates what the console should look like when run: Microsoft Visual Studio Debug Console Enter a number: 10 X:20 Y:478 C:\Users\gknapp\source epos\ConsoleApp1\bin\Debug etcoreapp3.1\ConsoleApp1.exe (process 7220) exited with cod e 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window. . . Test cases: User enters 10.0 X,Y output should be 20, 478 User enters -2 X,Y output should be -4, -4 2. Add a second console application (core) to your Visual Studio solution. Make it the startup project. In the console program's main function, write the C# code to do the following: Read in the names and ages of two people (say A and B) Set the value of Boolean variable Result. Result should be true if: A is older than B and B is at least 30, or A is at least 10 years younger than B and B is not 50 years old and set to false otherwise. Use string concatenation to create a message. Suppose person A is Joe and B Aimee, and Result is True, then the message should be "For Joe and Aimee, the result is: True" Following illustrates what the console should look like when run: Microsoft Visual Studio Debug Console Enter first person's name: Joe Enter first person's age: 30 Enter second person's name: Aimee Enter second person's age:25 For Joe and Aimee, the result is: False C:\Users\gknapp\source epos\ConsoleApp1\bin\Debug etcoreapp3.1\ConsoleAppl.exe (process 12904) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the conso le when debugging stops. Press any key to close this window... Test cases: A age 30, B age 25: result = false A age 35, B age 30: result = true A age 25, B age 30: result = false A age 50, B age 60: result =true A age 60, B age 50: result = true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions