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

  Implement a nice graph datastructure

Implement a nice graph datastructure. Implement two different greedy graph coloring algorithms. Shortest path algorithm and MST algorithms.

  Write a flowchart to solve any linear equation ax+b=01.

Write a flowchart to solve any linear equation ax+b=01. W Write a flowchart to solve any linear equation ax^2+bx+C=0

  Describe ways to generalize a simple sorting algorithm

Describe ways to generalize a simple sorting algorithm (such as insertion sort, or any other sort you are familiar with) to support this generalization

  Develop modified versions of the quicksort and mergesort

Using the recursive algorithm, described in the previous section, develop an iterative function with the same functionality as the recursive nextPermutation function. Recall, that the iterative function should not contain recursive calls - it uses..

  Algorithm to produce a list of customers

Draw an algorithm to produce a list of customers from the Glad Rags Clothing Company's customer master file.

  Show the evolution of the line in the first 10 minutes

Assume you are at the airport, waiting for security check.  There is one line(which is a FIFO queue), and 5 security check gates.  Each person reaching the front of the queue is checked by the first available security gate.

  Create the shoutbox class for your virtual world

Create the ShoutBox class for your Virtual World. Your ShoutBox class will have two methods - initialize your data structures with words or have the user enter the words

  Program to prompt the user to enter a postfix expression

Write a program to prompt the user to enter a postfix expression. When the user presses enter, the stack based method for constructing expression trees will be executed.

  System analystis you are required to analyse the

you are required to analyse the effectiveness of the qantas online air ticketing system. to do this you are required to

  Structural and behavioral models

Your analysis phase of the SRS project went well and your team feels good about their Functional, Structural, and Behavioral models. You also discussed the result of your analysis with the School of Prosperity (SoP) administration and they seem to be..

  What is the time complexity

Design an algorithm for finding the closest two numbers in the input list - What is the time complexity? Is it probable to improve the algorithm if the input is a sorted list?

  Show how the following values would be stored by machines

Show how the following values would be stored by machines with 32-bit words, using little endian and big endian format. Assume each value starts at address 016. Draw a diagram of memory for each, placing the appropriate values in the correct (and ..

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