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
Basile [38]
3 years ago
9

Write an expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targe

tValue. Otherwise, print "Not equal". Ex: If targetValue is 0.3333 and sensorReading is (1.0/3.0), output is: Equal
Computers and Technology
1 answer:
natali 33 [55]3 years ago
5 0

Answer:

The C++ code is given below with appropriate comments

Explanation:

//Remove this header file if not using visual studio.

#include "stdafx.h"

//Include the required header files.

#include <iostream>

//Use for maths function.

#include <cmath>

using namespace std;

//Define main function

int main()

{

      // Define the variables

      double targetValue = 0.3333;

      double sensorReading = 0.0;

      //Perform the opeartion.

      sensorReading = 1.0 / 3.0;

      // Get the absolute floating point value and

      // Check up to 4 digits.

      if (fabs(sensorReading - targetValue) < 1E-4)

      {

             //Print equal if the values are close enough.

             cout << "Equal" << endl;

      }

      else

      {

             //Print not equal if the values are not                  

             //close enough.

             cout << "Not equal" << endl;

      }

      system("pause");

      //Return the value 0.

      return 0;

}

You might be interested in
Public-key cryptography (a form of asymmetric cryptography) is an encryption method that's widely used because: 1) it is computa
rosijanka [135]

Answer:

C.

Explanation:

7 0
3 years ago
1. Create an interface called Runner. The interface has an abstract method called run() that display a message describing the me
Colt1911 [192]

Answer:

see explaination for program code

Explanation:

interface Runner

{

public abstract void run();

}

class Machine implements Runner

{

public void run()

{

System.out.println("Machine is running");

}

}

class Athlete implements Runner

{

public void run()

{

System.out.println("Athlete is running");

}

}

class PoliticalCandidate implements Runner

{

public void run()

{

System.out.println("Political Candidate is running");

}

}

class DemoRunners

{

public static void main (String[] args)

{

Machine m = new Machine();

m.run();

Athlete a = new Athlete();

a.run();

PoliticalCandidate pc = new PoliticalCandidate();

pc.run();

}

}

7 0
4 years ago
List out 20 output devices ​
GaryK [48]

Answer:

20 Examples Output Devices

Monitor.

Printer.

Audio Speakers.

Headphones.

Projector.

GPS.

Sound Card.

Video Card.

7 0
3 years ago
Read 2 more answers
Using the find and replace tool would be most appropriate when
mafiozo [28]

A. Changing the company name when the same letter is sent to different companies

The find and replace tool is meant to help replace all instances of a certain piece of text with a different piece of text.

For example, if a letter was sent to Company A, the find and replace tool could change every time the letter says “Company A” and make it say “Company B” instead so the same letter could be sent to Company B.

3 0
4 years ago
Read 2 more answers
This is science they just dont have the subject buy anyways 
Anna007 [38]
The environment helps us with many many hings thing. The most obvious plants helps us breath and we help them grow because we have the exact opposite breathing pattern. Animals poop almost anywhere they want and farms use it as fertilizer. I hope this enough to help you. Good luck with your work!!<span />
8 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program to test your functions as follows: Obtain a random number seed from the command line of your program using comma
    10·1 answer
  • What is the difference between the (BIOS) basic.input.output.system and R.O.M
    5·1 answer
  • 4. When inserting clip art into a page of text, which of the following is true? (1 point)
    14·2 answers
  • Consider the following method:
    8·2 answers
  • On an open book test, Anna was asked to predict how American laws may affect the Mexican way of life if the US Constitution was
    15·1 answer
  • Which of the following commands contains an error?
    8·1 answer
  • The CPU package is installed using the ____ process
    7·1 answer
  • Whitch action should a user take to ensure that formatting is applied to a row? A. use the ctrl+a keys. B. highlight the whole t
    11·1 answer
  • According to the municipal solid waste report what are the benefits of recycling
    6·1 answer
  • In which of these areas can software engineers specialize?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!