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
aniked [119]
3 years ago
7

Write a method that takes three numerical String values and sums their values. For example, the call sumStrings("1", "5", "7") w

ould return 13. This is done in Java.
Computers and Technology
1 answer:
masha68 [24]3 years ago
7 0

Answer:

public static int sumStrings(String s1, String s2, String s3) {

       int i1 = Integer.parseInt(s1);

       int i2 = Integer.parseInt(s2);

       int i3 = Integer.parseInt(s3);

       

       int sum = i1 + i2 + i3;

       return sum;

   }

Explanation:

- Create a method called <em>sumStrings</em> that takes three strings

- Convert each string to integer using Integer.parseInt() method

- Sum the strings

- Return the result

You might be interested in
A species of snake lives in a rainforest. Which would be an adaptation for this
raketka [301]

Answer:

The Answer is D

6 0
3 years ago
Read 2 more answers
Write the class RoadSegmet. The class inherits from Transportation Class. The Class have a vector hourlySpeeds data field which
OLEGan [10]

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;

};

5 0
2 years ago
What should you do when an error message pops up on the screen?
gladu [14]
D.) Write down the error message and research the cause based on the message.
5 0
2 years ago
Read 2 more answers
When you must give something up in order to get something else it's called
matrenka [14]

Answer:

Opportunity cost refers to what you have to give up to buy what you want in terms of other goods or services. When economists use the word “cost,” we usually mean opportunity cost.

Explanation:

please give me a heart

8 0
2 years ago
I want to do is speed test to do i go to for my computer
laiz [17]

I just go to the speed test on my browser

7 0
2 years ago
Other questions:
  • Tammy is preparing to give a presentation. she would like to view information that will remind her what to say to her audience b
    10·1 answer
  • Janet manages the security of the database servers at the mortgage company where she works. The servers are Windows Server 2016;
    15·1 answer
  • I need a good science fair name I’m doing a homemade water filter and I have no idea what the title should be plz help
    14·1 answer
  • Which of the following is constantly changing and advancing?
    11·1 answer
  • Write a method named lastIndexOf that accepts an array of integers and an * integer value as its parameters and returns the last
    15·1 answer
  • I need help<br> plsssssssss
    10·1 answer
  • I need help for my computer science class I would appreciate it
    11·1 answer
  • "To speed up magnetic hard drive performance , ___________ is often used. "
    15·1 answer
  • 5. Why do we need programming language?​
    13·2 answers
  • I WILL MARK BRAINLEST
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!