Answer:
Replace the comment with:
(c) double hours = Math.abs (marker1 - marker2) / 60.0;
Explanation:
See attachment for right presentation of question
Analyzing the options:
(a): May return a negative result
This option will return a negative value if marker1 is less than marker2 because it subtracts the absolute value of marker2 from the absolute value marker1.
This literally is not different from marker1 - marker2
(b): Incorrect expression
This divides only marker2 by 60, then subtracts the quotient from marker1. This is not the expected expression.
(c) This option is correct
This correctly calculate the positive difference between marker1 and marker2 and the result is divided by 60.0 (note 60.0 not 60)
(d) & (e) Integer division
When a variable declared as double is divided by an integer variable or value, the result of the computation is not always accurate due to approximation
Answer:
/*C++ program that prompts user to enter the name of input file(input.txt in this example) and print the sum of the values in the file to console. If file dosnot exist, then close the program */
//header files
#include <fstream>
#include<string>
#include <iostream>
#include <cstdlib> //needed for exit function
using namespace std;
//function prototype
int fileSum(string filename);
int main()
{
string filename;
cout << "Enter the name of the input file: ";
cin >> filename;
cout << "Sum: " << fileSum(filename) << endl;
system("pause");
return 0;
}
/*The function fileSum that takes the string filename and
count the sum of the values and returns the sum of the values*/
int fileSum(string filename)
{
//Create a ifstream object
ifstream fin;
//Open a file
fin.open(filename);
//Initialize sum to zero
int sum=0;
//Check if file exist
if(!fin)
{
cout<<"File does not exist ."<<endl;
system("pause");
exit(1);
}
else
{
int value;
//read file until end of file exist
while(fin>>value)
{
sum+=value;
}
}
return sum;
}//end of the fileSum
Explanation:
This is a C++ program that prompts user to enter the name of input file(input.txt in this example) and print the sum of the values in the file to console. If file dosnot exist, then close the program.
Check attachment for sample output screenshot.
Advantages to virtual keyboards:
- You have easy shortcuts
- Cooler emojis <span>
- And we have google voice (or Siri) with a click of a key
Disadvantages to a virtual keyboard:
- It is very easy to send something you don't want to send by
accidentally touching the send button
- It is harder for people with big hands to use
- </span>typing speed will likely be negatively impacted on a virtual keyboard<span>.
</span>
Advantages to using a physical keyboard:
- <span> The keyboard takes up no space on the front panel or on the display area.
</span>- <span>you are making use of muscle memory, which increases your speed
</span>- Typing on a touchscreen requires an on-screen keyboard, which lacks the tactile response of a real keyboard.
Disadvantages to using a physical keyboard:
- <span>For the average consumer, phones with a physical keyboard are a bit bulkier.</span>
- Most phones with a physical keyboard have to be designed a certain way to minimize space and increase efficiency.
- I<span>t is a slow method when you need to write a long piece of writing when there are faster ways such as scanning and dictation</span>