1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
blondinia [14]
2 years ago
14

Write the class RoadSegmet. The class inherits from Transportation Class. The Class have a vector hourlySpeeds data field which

will hold the speed for all 24 hours of the day (each index is 1 hour). You will be able to set a speed for a specific hour, or all 24 speeds at once using setHourSpeed(unsigned hour, double speed) or setAllHourSpeeds(const vector &) respectively.
The length of time on the road segment is calculated by taking it's distance and dividing by the speed at the time of departure. This length of time is then added to the departureTime parameter to get the arrivalTime.

Define a RiverSegment class that inherits from the base TransportationClass from above. This class will have a vector scheduledDepartureTimes data field that will keep track of the departure time (e.g. 10.5 represents the time 10:30) of all ferries on the river. You can assume these are sorted. Additionally, there is a _speed value that is the speed of the ferry at all times (ferries tend to be consistently slow). There is a setSpeed function to change the _speed value. Additionally, there is an addDepartureTime(double hour) function to add a departure time to the vector. Make sure the time are sorted

Computing the arrival time for the RiverSegment is a little more complicated since you need to wait for the next available departure time. Once you find the next available departure time (after the departure time passed in), you need to add the length of time on the river segment. This is done by dividing the _distance by the _speed. Add the time on the river to the departure time (from the vector of departure times) and this will give you the arrive time.

note: If there is no departure time scheduled for after your planned departure, you need to take the first available departure the following day. Our solution assumes the departure times are the same every day.

TransportationLink.h

#include

using namespace std;

#ifndef __TRANSPORTATIONLINK_H__
#define __TRANSPORTATIONLINK_H__

const int HOURS_PER_DAY = 24;
const int MINS_PER_HOUR = 60;
const int MINS_PER_DAY = MINS_PER_HOUR * HOURS_PER_DAY; //24 * 60

class TransportationLink {
protected:
string _name;
double _distance;

public:
TransportationLink(const string &, double);
const string & getName() const;
double getDistance() const;
void setDistance(double);

// Passes in the departure time (as minute) and returns arrival time (as minute)
// For example:
// 8 am will be passed in as 480 (8 * 60)
// 2:30 pm will be passed in as 870 (14.5 * 60)
virtual unsigned computeArrivalTime(unsigned minute) const = 0;
};

#endif

TransportationLink.cpp

#include "TransportationLink.h"

#include

using namespace std;

TransportationLink::TransportationLink(const string &name, double distance)
: _name(name), _distance(distance)
{}

const string & TransportationLink::getName() const {
return _name;
}

double TransportationLink::getDistance() const {
return _distance;
}

void TransportationLink::setDistance(double distance) {
_distance = distance;
}
Computers and Technology
1 answer:
OLEGan [10]2 years ago
5 0

Answer:

The length of time on the road segment is calculated by taking it's distance and dividing by the speed at the time of departure. This length of time is then added to the departureTime parameter to get the arrivalTime.

Define a RiverSegment class that inherits from the base TransportationClass from above. This class will have a vector<double> scheduledDepartureTimes data field that will keep track of the departure time (e.g. 10.5 represents the time 10:30) of all ferries on the river. You can assume these are sorted. Additionally, there is a _speed value that is the speed of the ferry at all times (ferries tend to be consistently slow). There is a setSpeed function to change the _speed value. Additionally, there is an addDepartureTime(double hour) function to add a departure time to the vector. Make sure the time are sorted

Computing the arrival time for the RiverSegment is a little more complicated since you need to wait for the next available departure time. Once you find the next available departure time (after the departure time passed in), you need to add the length of time on the river segment. This is done by dividing the _distance by the _speed. Add the time on the river to the departure time (from the vector of departure times) and this will give you the arrive time.

note: If there is no departure time scheduled for after your planned departure, you need to take the first available departure the following day. Our solution assumes the departure times are the same every day.

TransportationLink.h

#include <string>

using namespace std;

#ifndef __TRANSPORTATIONLINK_H__

#define __TRANSPORTATIONLINK_H__

const int HOURS_PER_DAY = 24;

const int MINS_PER_HOUR = 60;

const int MINS_PER_DAY = MINS_PER_HOUR * HOURS_PER_DAY; //24 * 60

class TransportationLink {

protected:

string _name;

double _distance;

public:

TransportationLink(const string &, double);

const string & getName() const;

double getDistance() const;

void setDistance(double);

// Passes in the departure time (as minute) and returns arrival time (as minute)

// For example:

// 8 am will be passed in as 480 (8 * 60)

// 2:30 pm will be passed in as 870 (14.5 * 60)

virtual unsigned computeArrivalTime(unsigned minute) const = 0;

};

You might be interested in
Teaching Siri or the Google Assistant how to recognize your voice by reading to it is an example of ________.
nata0808 [166]

Answer:

4. Supervised learning.

Explanation:

Supervised and Unsupervised learning are both learning approaches in machine learning. In other words, they are sub-branches in machine learning.

In supervised learning, an algorithm(a function) is used to map input(s) to output(s). The aim of supervised learning is to predict output variables for given input data using a mapping function. When an input is given, predictions can be made to get the output.

Unsupervised learning on the other hand is suitable when no output variables are needed. The only data needed are the inputs. In this type of learning, the system just keeps learning more about the inputs.

Special applications of supervised learning are in image recognition, speech recognition, financial analysis, neural networking, forecasting and a whole lot more.

Application of unsupervised learning is in pre-processing of data during exploratory analysis.

<em>Hope this helps!</em>

8 0
3 years ago
Which statement best describes the purpose of the Insert Function dialog box?
ryzh [129]

Answer:

It is used to insert a specific function by selecting it from the Insert Function list.

Explanation:

The insert function list various functions, and we can insert a specific function through a selection of one of the options from the insert function list. And it is certainly not used to display the information according to arguments used in the function, and which is quite clear. Also, it is used to put each type of excel functions in a certain order. And it is also not used to search for any specific functions through any keyword and description. Hence, the correct option is the second option.

3 0
3 years ago
Select the correct answer.
IceJOKER [234]

Answer:

Scott should <u>"hire a coach to teach them about new technologies".</u>

Explanation:

A coach is the person that will help Mr. Scott to know about different technologies that will help him to be a good parent. This will help him to enhance his skills that are related to technologies in terms of parenting skills. Option C is the best suitable answer that help him to learn more about technology and trends.

5 0
2 years ago
program that reads numbers from scanf (keyboard) and then sums them, stopping when 0 has been entered. Construct three versions
Alex17521 [72]

Answer:

Explanation:

I'm going to write three examples in C language:

int main() {

   int n, i, sum = 0;

   printf("Enter the number: ");

   scanf("%d", &n);

   for (i = 1; i <= n; ++i) {

       sum += i;

   }

   printf("Sum = %d", sum);

   return 0;

}

int main() {

   int n, i, sum = 0;

   printf("Enter a number: ");

   scanf("%d", &n);

   i = 1;

   while (i <= n) {

       sum += i;

       ++i;

   }

   printf("Sum = %d", sum);

   return 0;

}

int main() {

   int n, i, sum = 0;

   do {

       printf("Enter a number: ");

       scanf("%d", &n);

   } while (n <= 0);

   for (i = 1; i <= n; ++i) {

       sum += i;

   }

   printf("Sum = %d", sum);

   return 0;

}

7 0
3 years ago
Michael is discussing various project needs with his team. Match Michael's statement with the way project management can help th
VashaNatasha [74]

Answer:

"We need to maintain a performance standard for the processes in the project." - <em>managing quality</em>

"There can be certain threats or problems during project execution. We need to handle them." - <em>managing risks</em>

"The client needs some additional requirements in the project. We need to accommodate them." - <em>managing change</em>

"The project activities are getting chaotic. We need to manage them efficiently." - <em>organizing activities</em>

Explanation:

Project management can help Michael manage all these needs that he and his team have. Project management is the application of skills and tools to a particular project. This requires certain knowledge and techniques in order to ensure that the project requirements are properly met. Project management does not generally deal with a whole company at once. Instead, a project is a temporary situation, and it needs to be completed within a specific timeframe. It also means that such a project has a defined scope and resources, which make efficient management even more important.

5 0
2 years ago
Other questions:
  • The __________ energy in food is changed into mechanical energy by your muscles.
    9·1 answer
  • If you know about 3D printers could you help me fix mine?
    8·1 answer
  • Targeting encourages drivers to scan far ahead and _____________. A. focus their visual attention on the next point on the road
    8·2 answers
  • Which option in presentation software can you use to apply a “fly in” effect to the objects on a slide? A)flowchart B)shapes C)
    11·2 answers
  • Does anyone know how to execute this assignment on Scratch?
    8·1 answer
  • How do i find the greatest common factor of two numbers?
    14·1 answer
  • Write down the stages in the information prcessing cycle in correct order​
    5·1 answer
  • This logo bby im sorry huhu​
    11·1 answer
  • whenever I try to make an account it says it can't sign me up at this time or something- can you help?-
    10·1 answer
  • Show that ALLDFA is in <img src="https://tex.z-dn.net/?f=%5Cmathrm%7BP%7D" id="TexFormula1" title="\mathrm{P}" alt="\mathrm{P}"
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!