quiz2Solu

quiz2Solu - Quiz #2 First Name (print):...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE182 Applied Problem Solving with C# Quiz #2 First Name (print): ____________________ Last Name (print):_________________________ 1. Pick an appropriate data type, declare a variable for the following (each 0.5 pts, total 2 pts) a. your last name string lastName; b. your marital status (Married?) bool marriedOrNot; c. the number of courses you took from ASU this semester int numOfCourses; d. declare a constant that hold the federal tax rate as 0.285 const double TAX_RATE = 0.285; 2. Pick one (circle one). To assign int variable y ’s value to int variable x , we write: (1 pts) (1) y = x; (2) x = y; (3) y := x; (4) x == y; 3. What is the output? (3 pts) (1) Console.WriteLine ( 1 apple plus 1 orange equals + 1 + 1 + fruits ); 1 apple plus 1 orange equals 11 fruits (2) Console.WriteLine ( 1 apple plus 1 orange equals + (1 + 1) + fruits ); 1 apple plus 1 orange equals 2 fruits (3) double y = 5 / 2; Console.WriteLine ( y is: + y); y is: 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE182 Applied Problem Solving with C#
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Quiz #2 First Name (print): ____________________ Last Name (print):_________________________ 4. Below is the skeleton of a program that coverts an Euro amount into an equivalent US dollar amount. The euro amount is got from the keyboard. The exchange rate is: 1 Euro = 1.46 US$, according to the comments, finish the program. (4 pts) //This program converts an euro amount into US $ amount using System; namespace EuroToDollar { class EuroToDollar { public static void Main() { //varible declaration double euroAmount, usAmount; //declare a constant for the exchange rate const double RATE = 1.46; //user prompt Console.Write("Please enter the amount in Euro: "); //get euro amount from the keyboard euroAmount = double.Parse(Console.ReadLine()); //convert usAmount = euroAmount * RATE; //output the equivalent US $ amount Console.WriteLine("\n Euro amount $ + euroAmount + converts to $ + usAmount); } } }...
View Full Document

This note was uploaded on 02/11/2010 for the course CSE CSE182 taught by Professor Feng during the Spring '10 term at ASU.

Page1 / 2

quiz2Solu - Quiz #2 First Name (print):...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online