Question

C++ I need help with this part of the code. It is part of a broader...

C++

I need help with this part of the code. It is part of a broader program that will include this code.This time you are going to create a speedometer calculator. In this program you will ask the user for the tire sizes (old & new). Then you will calculate the difference between the actual speed of the vehicle and what the speedometer shows in 10 mph increments from 10-100. You will save all of actual speeds in an array. For example and using the ratio difference below, at 60 mph on the speedometer the actual speed of the vehicle is 66 mph. so you will store the actual speed in the array of 66 mph. For the display, see the picture below. Oh yeah, don’t forget about giving the user the ability to run the program as many times as they want, again like in the picture below. Since this is a ratio problem we will be dealing with it in that manner. What that means is that if we have a tire diameter that is 30” (inches) and we increase the size to 33” we have a 10% increase in size therefore our speedometer will also be off by that same 10%. Formula: tireRatio = newTireSize / oldTireSize

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go this code and let me know if u need any changes in this.Thank You
_________________

#include <iostream>
#include <string>
#include <cctype>
#include <iomanip>
using namespace std;

int main ()
{
       //setting the precision to two decimal places
   std::cout << std::setprecision(1) << std::fixed;
   //Declaring variables
int oldTyre,newTyre;
   char ch;
   int SIZE=10;
   double arr[SIZE];
   cout<<"Tire Size Program"<<endl;
     
   cout<<"Do you want to do this tire conversion program ? Y or N :";
   cin>>ch;

if(ch=='y'||ch=='Y')
{
   //Getting the input entered by the user
cout<<"Please enter the old tire size :";
cin>>oldTyre;
cout<<"Please enter the new tire size :";
cin>>newTyre;
double ratio =((((double)newTyre)/oldTyre)*100)-100;

for(int i=0;i<SIZE;i++)
{
   arr[i]=(i+1)*10+(i+1)*10*(ratio/100);
}
for(int i=i;i<10;i++)
{
   cout<<"When your spedo is reading "<<i<<" you're actually going :"<<arr[i]<<endl;
}
  
}
  

return 0;
}

__________________________

Output:

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
C++ I need help with this part of the code. It is part of a broader...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The speedometer readings in passenger cars are based on angular speed of the car's tire axle....

    The speedometer readings in passenger cars are based on angular speed of the car's tire axle. Because car's tires are filled with air [typically to the pressure of about 30 psi (pounds-square-inch)], the actual tire radius can be a bit different depending on the air temperature. You want to understand the impact of the air temperature on the tire radius and thus on the accuracy of the speedometer reading based on the ideal gas law. To simplify the calculation, you...

  • Could you please help I will upvote. Problem: The stick diagram of a RWD 5-speed MT...

    Could you please help I will upvote. Problem: The stick diagram of a RWD 5-speed MT is shown below. The final drive ratio is ia and the tire radius is R (ft.) a) Find the transmission ratios in forward and reverse gears in terms of the tooth numbers as labeled. b) What is the speed difference that needs to be synchronized in a 1-2 shift when the shift is made at a vehicle speed V (mph)? c) What is the...

  • Hi there I need help coming up with the C code for this problem. At the...

    Hi there I need help coming up with the C code for this problem. At the beginning of the program and before each function use comments to explain what the function does. Do not use global variables 1. The Pascal triangle can be used to compute the coefficients of the terms in the expansion of atb In a Pascal triangle, each element is the sum of the element directly above it and the element to the left of the element...

  • Part I: Create a program class named TestArrays This class should have a main() method that...

    Part I: Create a program class named TestArrays This class should have a main() method that behaves as follows: Create an integer array of size 10. Using a loop, fill the elements with increments of 5, starting with 5 in the first element. Using the array elements, sum the second, fifth and seventh elements. Display the sum with a label. Change the fourth element to 86. Subtract 9 from the ninth element. Using a loop, display the elements of the...

  • just the extra credit part please Your customer needs an automated system to patrol the highways....

    just the extra credit part please Your customer needs an automated system to patrol the highways. The job of the system is to collect the following information on vehicles traveling down a certain stretch of highway: license plate number, current speed, and speed limit. A program is required to determine if a speeding ticket is needed for each set of data. Ticket will only be issued when number of miles per hours (mph) over the speed limit is at least...

  • Can someone please help, third time I'm asking. I need a basic javascript with no push...

    Can someone please help, third time I'm asking. I need a basic javascript with no push or splice command. Please don't post a picture of the code,because my vision is poor and I won't be able to see it. Also, I need breakdown of what's in HTMLand what' s in javascript. All requirements are below. Thanks for your help. This is a 2 part assignment, but both parts can be completed in one program. Also, please follow ALL Required Programming...

  • PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO Exercise #2:...

    PLEASE DO IN C# AND MAKE SURE I CAN COPY CODE INTO VISUAL STUDIO Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The program prompts the users to enter the array size. Then prompts the user to initialize each array with integer values. The program defines method Compare() that takes two signal-dimensional arrays of type integer. The method compares the content of the arrays and returns...

  • I need this code in C++. Should be able to read from a file as stated...

    I need this code in C++. Should be able to read from a file as stated in the directions Exercise #1: Develop a program that prints out the sum of each column of a two-dimensional array The program defines method sumColumn takes a two-dimensional array of integers and returns a single dimensional array that stores the sum of columns of the passed array. The program main method prompts the user to enter a 3-by-4 array, prints out the array, and...

  • C++ Hey, I really need help with this lab. I don't understand the function part at...

    C++ Hey, I really need help with this lab. I don't understand the function part at all. It'll be great way for me to understand. Than you Functions and loops: Write a program that will ask the user which type of triangle they would like to draw on the characters. The choices are screen with left-top-big left-bottom-big right-top-big right-bottom-big Get the user's choice, ask how big it should be, and then draw the shape. After each successful drawing, ask the...

  • Hi I need help doing this problem *The program must re-prompt as long as invalid input...

    Hi I need help doing this problem *The program must re-prompt as long as invalid input is inserted Implement a program that manages shapes. Implement a class named Shape with a virtual function area()which returns the double value. Implement three derived classes named Diamond, Oval, and Pentagon. Declare necessary properties in each including getter and setter function and a constructor that sets the values of these properties. Override the area() function in each by calculating the area using the defined...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT