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
Nady [450]
3 years ago
6

Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x miles per hour and car B tr

avels south at an average speed of y miles per hour. Write a program that prompts the user to enter: The average speed of both the cars The elapsed time (in hours and minutes, separated by a space) Ex: For two hours and 30 minutes, 2 30 would be entered

Computers and Technology
1 answer:
drek231 [11]3 years ago
3 0

Answer:

Here is the C++ program:

#include <iostream>  // to use input output functions

#include <cmath>  // to use math functions like sqrt()

#include <iomanip>  //to use setprecision method

using namespace std;   //to access objects like cin cout

int main ()  {  //start of main function

  double speedA;  //double type variable to store average speed of car A

  double speedB;  //double type variable to store average speed of car B

  int hour;  //int type variable to hold hour part of elapsed time

  int minutes;  //int type variable to hold minutes part of elapsed time

  double shortDistance;  // double type variable to store the result of shortest distance between car A and B

  double distanceA;  //stores the distance of carA

  double distanceB;  //stores the distance of carB

  double mins,hours;   //used to convert the elapsed time

cout << "Enter average speed of car A: " << endl;  //prompt user to enter the average speed of car A

cin >> speedA;   //reads the input value of average speed of car A from user

cout << "Enter average speed of car B: " << endl ;  //prompt user to enter the average speed of car B

cin >> speedB;   //reads the input value of average speed of car A from user

cout << "Enter elapsed time (in hours and minutes, separated by a space): " << endl;  //prompts user to enter elapsed time

cin>> hour >> minutes;    //reads elapsed time in hours and minutes

  mins = hour * 60;  //computes the minutes using value of hour

  hours = (minutes+mins)/60;     //computes hours using minutes and mins

distanceA = speedA * (hours);  // computes distance of car A

distanceB = speedB * (hours);   //computes distance of car B

   shortDistance =sqrt((distanceA * distanceA) + (distanceB * distanceB));   //computes shortest distance using formula √[(distanceA)² + (distanceB)²)]

cout << "The (shortest) distance between the cars is: "<<fixed<<setprecision(2)<<shortDistance;

//display the resultant value of shortDistance up to 2 decimal places

Explanation:

I will explain the program with an examples:

Let us suppose that the average speeds of cars are:

speedA = 70

speedB = 55

Elapsed time in hours and minutes:

hour = 2

minutes = 30

After taking these input values the program control moves to the statement:

mins = hour * 60;  

This becomes

mins = 2 * 60

mins = 120

Next

hours = (minutes+mins)/60;

hours = (30 + 120) / 60

         = 150/60

hours = 2.5

Now the next two statements compute distance of the cars:

distanceA = speedA * (hours);  

this becomes

distanceA = 70 * (2.5)

distanceA = 175

distanceB = speedB * (hours);

distanceB = 55 * (2.5)

distanceB = 137.5

Next the shortest distance between car A and car B is computed:

shortDistance = sqrt((distanceA * distanceA) + (distanceB * distanceB));

shortDistance = sqrt((175 * 175) + (137.5 * 137.5))

                        = sqrt(30625 + 18906.25)

                        = sqrt(49531.25)

                        =  222.556173

shortDistance =  222.56

 

Hence the output is:

The (shortest) distance between the cars is: 222.56        

You might be interested in
Write down the three part of a computer.<br>​
Nostrana [21]

Answer:

1 system unit 2 monitor 3 keyboard

5 0
3 years ago
Match the definitions to their respective cli hot keys and shortcuts. (not all options are used.)
lord [1]
  • Tab ( Complete omitted commands and parameters )
  • Space bar ( Display the next screen )
  • Up arrow ( Scroll backward through previously entered commands )
  • ? ( Provides context-sensitive help )
  • Ctrl Shift 6 ( Cancel commands such as trace and ping).

What is CLI tools ?

A command line interface (CLI) is a text-based user interface (UI) used to run programs, manage computer files, and interact with a computer. A command line interface is also known as a command line user interface, console user interface, or character user interface.

Why do we use CLI tools ?

The CLI is a command line utility that accepts text input and executes operating system functions. In the 1960s,  this was the only way to interact with a computer, as only computer terminals were in use. In the 1970s and 1980s, command line input was widely used on Unix systems and personal computer systems such as MS-DOS and Apple DOS.

To know more about CLI Tools visit here:

brainly.com/question/13263568

#SPJ4

4 0
1 year ago
30 points!
Ad libitum [116K]

Answer:

"data" (and any subsequent words) was ignored because we limit queries to 32 words.

Imagecbseacademic.nic.in › 402-IT...PDF

INFORMATION TECHNOLOGY-402 CLASS-X ... - CBSE Academic

SESSION 3: CREATE AND USE TEMPLATE ... You can create a new style by copying an existing manual format. ... When the image is in a file stored on the computer, you can insert it into an Open.

212 pages·8 MB

Imagesupport.microsoft.com › office › pr...

Present data in a chart - Word - Microsoft Support

Insert a chart by embedding it into your document ... Step 4: Show or hide a legend ... 2. The plot area of the chart. 3. The data points of the data series that are plotted in the ... After you create a chart, you can modify any one of its elements.

support.microsoft.com › office › us...

Use charts and graphs in your presentation - PowerPoint

Add a chart or graph to your presentation in PowerPoint by using data from Microsoft Excel.

People also search for

Types of graphs in statistics

Types of graphs in statistics

Line chart

Line chart

Bar chart

Bar chart

Histogram

Histogram

Area chart

Area chart

Line graph

Line graph

Pie chart

Pie chart

Dot plot

Dot plot

Graph

Graph

More results

Types of graphs in statistics

When inserting charts on your document, what Microsoft Office application pops up

Write down the steps to insert a chart in slide in Impress

PPT charts and graphs

Feedback

Imageopentextbc.ca › dbdesign01 › chapt...

Chapter 16 SQL Data Manipulation Language – Database Design ...

In this chapter, we will describe how to use the SELECT, INSERT, UPDATE, and DELETE SQL DML command statements ...

opentextbc.ca › dbdesign01 › sql-str...

Chapter 15 SQL Structured Query Language – Database Design ...

Perform complex queries to transform raw data into useful information. In this chapter, we will focus on using SQL to create ...

Imagecorporatefinanceinstitute.com › study

Types of Graphs - Top 10 Graphs for Your Data You Must Use

#3 Combo Chart. The above two types of graphs can be combined to create a combo chart with bars and lines. This is ...

Imagewww.originlab.com › origin

Origin: Data Analysis and Graphing Software - OriginLab

With over 100 built-in graph types and point-and click customization of all elements, Origin makes it easy to create and ...

Imagedocs.aws.amazon.com › latestPDF

Amazon Athena - User Guide - AWS Documentation - Amazon.com

or may not be affiliated with, connected to, or sponsored by Amazon. ... Using the AWS Serverless Application Repository . ... Creating Tables Using AWS Glue or the Athena Console . ... Multiple JSON records return a SELECT COUNT of 1 .

Imagewww.mindtools.com › pages › article

Charts and Graphs - Communication Skills From MindTools.com

When you show an effective graph or chart, your report or presentation ... They all look smart, but which one works best for your data, and for your audience? ... How to Create Basic Graphs and Charts ... Figure 3: Example of a Line Graph.

Imagewww.mathworks.com › matlabcentral

MATLAB Answers - MathWorks

Hi, I would like to create a weighted sample from an m by n matrix starting from an excel file ("DataTab", please see image ...

Get the answer that you’re looking for added to the web

Your question will be shared anonymously with online publishers who may be interested in answering it

What’s your question?

Make sure that you don’t include any private info

Learn more

Submit

Related searches

How to update charts in PowerPoint from Excel automatically

What are the 6 types of graphs

Types of graphs math

Cool graphs in PowerPoint

Dynamic charts in PowerPoint

How to present graphs in PowerPoint

How to create a chart in PowerPoint from Excel data

Types of graph with example

More results

India

Arkula Proper, Karnataka - Based on your past activity - Learn more

Terms

5 0
3 years ago
What are the five types of alignment in Word?
Basile [38]
There are four types of alignment in word.
Left-aligned text
Right-aligned text
Center-aligned text
Justified text
6 0
3 years ago
Read 2 more answers
Recursive definitions for subsets of binary strings. About Give a recursive definition for each subset of the binary strings. A
Masteriza [31]

Answer:

this program was written in JAVA

Explanation:

import java.util.Scanner;

public class RecursivePalindromeJava

{

public static boolean checkPalindrome(String str)

{

if(str.length() == 0 || str.length() == 1)

return true;

if(str.charAt(0) == str.charAt(str.length() - 1))

return checkPalindrome(str.substring(1, str.length() - 1));

return false;

}

public static void main(String[]args)

{

Scanner sc = new Scanner(System.in);

System.out.println("Please enter a string : ");

String strInput = sc.nextLine();

if(checkPalindrome(strInput))

{

System.out.println(strInput + " is palindrome");

}

else

{

System.out.println(strInput + " not a palindrome");

}

sc.close();

)

)

8 0
3 years ago
Other questions:
  • For any element in keysList with a value greater than 60, print the corresponding value in itemsList, followed by a semicolon (n
    14·2 answers
  • Your friends parents are worried about going over their budget for the month. Which explains would you suggest is not a need.
    14·2 answers
  • What is the value of the variable result after these lines of code are executed?
    5·2 answers
  • Clifford visits a website that has a lot of multimedia content. He watches a few videos. However, some videos do not play. The b
    14·1 answer
  • Microsoft acknowledged that if you type a res:// url (a microsoft-devised type of url) which is longer than ____ characters in i
    9·1 answer
  • N, or central processing unit, is also known as the
    10·2 answers
  • Write a JAVA program containing a method called hasEight(), which takes an int as input and returns true if the number contains
    14·1 answer
  • Network servers and web servers are examples of what type of server?
    9·2 answers
  • The number of swappings needed to sort the number 8, 22, 7, 9, 31 in ascending order, using bubble sort is
    9·1 answer
  • Read the citation example, and then use the drop-down menus to identify each part.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!