Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

C Programming Lab Assignment -

Programming Exercise - The purpose of this lab is to

  • Demonstrate that you can create and manipulate structures, using pointers.
  • Demonstrate that you can sort an array of structures, using appropriate comparison functions.

Statement of Problem

Write a program (e.g., 'lab4.c') that generates a sorted list of rental properties.

Each property will be implemented as a structure that has members that record the street name, the street number, the number of bedrooms, and the monthly rent.

Using a typedef to simplify naming your struct is a good idea, but not mandatory. You will initialize a 12-element array of these structs. You will provide your own (fictitious) street names and numbers, but will randomly generate the number of bedrooms (1-4) and the rent (800-1200, in one hundred dollar increments). The random numbers must vary each time you run the program. Three of your rental properties must use exactly these addresses ( "24 Sussex Drive", "1 Sussex Drive", and "5 Sussex Drive"), and two of them must exist on another street. All the other properties can exist on their own streets.

You'll need a function to print a summary of each rental property, which will be used to print out lists. This function should use fixed-width columns (as per earlier labs) to make the list is easy to read (i.e., by having the rents for each property all aligned in a single column, ditto for the number of bedrooms). You will then print out the list three times, with the following sorting criteria:

1. Sorted by number of bedrooms, increasing. If there are two or more rental properties with the same number of bedrooms, then those properties will be ordered by the monthly rent, increasing.

2. Sorted by rent, increasing. If there are two or more rental properties with the same monthly rent, then those properties will be ordered by the number of bedrooms, increasing.

3. Sorted by street address, increasing. The sorting is by street name first, then street number (e.g., "5 Sussex Drive" and "24 Sussex Drive" come before "1 Wellington Avenue") You will add an appropriate header before each list, as demonstrated in the following sample output.

Please check that you've satisfied the following submission requirements -

1. Did you make sure that you have a header comment in your source files?

2. Did you confirm that your zipped submission is a ".zip" file (not a '.rar' or '.tar.gz' or '.7z' file)?

3. Did you zip up a folder that includes your user name, and the lab/assignment indicator? I.e., if you open up your own zipped submission, you should see a folder called (for example) "smit9112_L4". If you just see file(s), you've done it wrong, and you'll need to go to the parent folder, and try zipping your lab folder.

4. Did you remove all the unnecessary files from the folder contained in your zipped submission?

I.e., you open up your own zipped submission, and click on the folder called (for example) "smit9112_L4", you should see just your makefile and your source files (e.g., lab4.c).

5. Is your makefile actually called 'makefile' or 'Makefile' (without any filename extensions?)

Attachment:- Assignment File.rar

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92808767
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in C/C++

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

  • 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