Ask DOT NET Expert

Develop a C# console application that implements two parallel int arrays in Main, one called apartment and the other called rent. Each array will hold 5 integer values. Use an initializer to fill the apartment array with the values {123, 204, 601, 609, 612}. Use an initializer to fill the rent array with the values {500, 750, 495, 800, 940}. 
Create two static methods, one called getRent and one called printit. When the getRent method is called from Main you should pass the apartment array by reference, the rent array by reference and the apartment number console entry.
In the getRent method you should use a for loop to match apartment number passed to the method and match it to the apartment numbers in the apartment array that was passed to the getRent. When a match is found in the apartment number array call the printit method from the getRent method and pass by value the apartment number and the matching rent value from the rent array to the printit method.
In the printit method print the apartment number and the rent for that apartment to the console as shown in the output ex below. When you print the output, instead of using a string concatenation (Console.prepareLine("Rent for apartment # " + choice + " is $" + rent);) use a StringBuilder object. The string parts of the message ("Rent for apartment #" and " is $") should be declared as separate strings. Using the StringBuilder object methods, you will append the two strings and two integer values together and prepare the final appended output to the console.
The appends and output should all be done in the print method.
Enter the apartment number 601
Rent for apartment # 601 is $495
Press any key to continue . . .  

DOT NET, Programming

  • Category:- DOT NET
  • Reference No.:- M987909

Have any Question?


Related Questions in DOT NET

Assignment specificationthis assignment is split into two

ASSIGNMENT SPECIFICATION This assignment is split into two documents. 1. Assignment Specification. This document contains the specification for what you will be required to do. 2. Assignment Addendum. This document conta ...

Scenariouser modelling inc would like to organize a series

Scenario User Modelling Inc. would like to organize a series of conferences focusing on research topics in the area of user adaptive systems and personalization. They need to organize annual conferences for researchers a ...

Casewe sell pdfs from our site and pdfs can be ordered from

Case We sell pdf''s from our site and pdfs can be ordered from the site by selecting a book, putting it in a shopping cart, then signing in with a password or as a guest, and then checking out. For some reason, when a pu ...

Summarythis assessment requires you to develop a simple

Summary This assessment requires you to develop a simple text editor with a basic offline user login. It is a windows application that will allow new uses to be added, existing users to login, and to create/save/edit tex ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As