Write a programming for sorting

Assignment Help Data Structure & Algorithms
Reference no: EM13842198

1 : Write the header file Car.h for the Car class. The Car class has three data members: miles_per_gallon (double), fuel (double), and model (string). The Car class has a constructor that initializes each data member. The Car class has four additional member functions:

get_model : no parameters, returns model

drive : double miles parameter, returns nothing

add_fuel : double gallons parameter, returns nothing

low_on_fuel : no parameters, returns true or false

Do not provide the implementation of the member functions.

2: Write the source code file

Square.cpp

. Include necessary header files and implementation of each member function of the following

Square

class.

class Square

{

public:

Square(double initial_length, string initial_color);

doubleget_length() const;

stringget_color() const;

doubleget_area() const;

private:

double length;

string color;

};

The area of a square is length x length.

3: Write a void function named sort2 that takes two string parameters and sorts them. The function swaps the values of the string parameters if the 1st string is lexicographically greater than the 2nd string and otherwise leaves the strings unchanged. For example:

string s1 = "Orange";

string s2 = "Apple";

sort2(s1, s2); // now s1 is "Apple" and s2 is "orange"

Reference no: EM13842198

Questions Cloud

Differences between the structured design methodology : differences between the structured design methodology
Plot the observed spot price and observed futures price : Plot the observed Spot Price, observed Futures Price, and the Theoretical Futures Price over the eight months to maturity - What is the current value of this future contract if you treat the dividend income as a yield?
How many of the units that were started during october : Direct materials costs $39,200 Conversion costs $30,800 Manufacturing costs added during the accounting period. How many of the units that were started during October were completed during October?
Explain differences among management assertions about events : Explain the differences among management assertions about classes of transactions and events, general transaction-related audit objectives, and specific transaction-related audit objectives and their relationships to each other.
Write a programming for sorting : write a programming for sorting
How safe are immunization for children : Health: Immunization and children- How safe are immunization for children
Prepare a business plan for hot mom tshirt : Business Name: Hot MoM's Tshirt. Business Plan will have- Executive Summary - the core of your business planCompany Summary, Products/Services
Explain how is the ricardian model was tested empirically : Explain how is the Ricardian model was tested empirically. To what extent can we assert that the Ricardian model provides a good representation of the real world
Why motivational considerations be a part of budget planning : Why should motivational considerations be a part of budget planning and utilization? List several ways to motivate employees with budgets.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  What is the minimum number of attendants

A nursing home employs attendants who are needed around the clock. Each attendant is paid the same, regardless of when his or her shift begins. Each shift is 8 consecutive hours.

  Solving information technology question

XYZ Corporation has a small office with eighty users in California. The office employs a file and print server that caters to user requests.

  Question related to normalization

Think about a typical job order that might include the following information. Design a single table to hold all the data needed to store a job order including this information.

  Prepare a currency conversion design

currency conversion design pseudocodeprogram pseudocodestart main moduledeclare option 0declare value 0declare

  Write true if the statement is true or false

It is impossible to over-train a multi-layer feed-forward network using the back-propagation learning algorithm. It is guaranteed that the longer you train your system, the more accurate it will perform.

  Explain solution to recurrence-appealing to recursion tree

Solve the following recurrence relations by the method of your choiceT(n) = 1 for n = 4 and T(n) =pnT(pn) + n for n > 4. Argue that the solution to the recurrence T(n) = T(n=3) + T(2n=3) + cn is (n lg n) by appealing to the recursion tree.

  Justify characterizing data types according to task taxonomy

Justify characterizing data types according to task taxonomy. Support your response. Assess the value to an interface designer, of being familiar with the seven basic tasks and create an argument for which three of the seven basic tasks are the mo..

  Design algorithm that plans your optimal investment strategy

Prove that the problem of planning your optimal investment strategy exhibits optimal substructure and design an algorithm that plans your optimal investment strategy. what is the running time of your algorithm?

  Hash values

Suppose these names have the following hash values. Insert them into the extendible hash table shown below. Each leaf can only hold 4 entries.

  Modify algorithm to always select president of company

How would you modify your algorithm to always select the president of the company (regardless of his fun rating or the consequences on the overall amount of fun we can achieve)?

  Algorithm for partitioning a set of n weights into k

give a greedy algorithm for partitioning a set of n weights into k bins. b) does it find the perfect solution?

  Create a recursive backtracking solution

The columns and rows of the matrix are the regions while the cells contain a 0 if the two regions are not adjacent and a 1 if they border. Create a recursive backtracking solution which accepts as interactive input from the user the number of regi..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd