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
Butoxors [25]
4 years ago
12

Suppose that the variables grade1, grade2, and grade3 are declared as follows:

Computers and Technology
2 answers:
wel4 years ago
6 0

Answer:

Option B (grade1 + grade2 + grade3) / 3.0

Explanation:

The most accurate result is calculated by the expression given in the option B.  This is because all the <em>grade1</em>, <em>grade2</em> and <em>grade3</em> variables are integer type and therefore we need to add a decimal point after divisor (e.g. 3.0) so that the decimal points of the result can be preserved.

For example:

(88 + 92 + 83) / 3.0  should result in 87.66666666666667

If we do  (88 + 92 + 83) / 3, the decimal points are truncated to 87.

The expression in option c, (double)((grade1 + grade2 + grade3) / 3), will result in 87 as the  (grade1 + grade2 + grade3) / 3 will be evaluated first prior to converting into double type.

The expression in option d and e are inaccurate as they don't calculate average of the three variables.  

Mnenie [13.5K]4 years ago
5 0
A; you have to add the grades to have the total and then divide by 3 because there are 3 variables. 
You might be interested in
Question 6 Which of the following statements about datasets used in Machine Learning is NOT true? 1 point Testing data is data t
Inessa [10]

Answer:

Training data is used to fine-tune the algorithm’s parameters and evaluate how good the model is

Explanation:

The statement about datasets used in Machine Learning that is NOT true is "Training data is used to fine-tune algorithm’s parameters and evaluate how good the model is."

This is based on the fact that a Training dataset is a process in which a dataset model is trained for corresponding it essentially to fit the parameters.

Also, Testing the dataset is a process of examining the performance of the dataset. This refers to hidden data for which predictions are determined.

And Validation of dataset is a process in which results are verified to perfect the algorithm's details or parameters

4 0
3 years ago
A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: the name of the clie
timama [110]

Answer:

see explaination

Explanation:

Java code

//Header file section

import java.util.Scanner;

import java.io.*;

//main class

public class SalesTestDemo

{

//main method

public static void main(String[] args) throws IOException

{

String inFile;

String line;

double total = 0;

Scanner scn = new Scanner(System.in);

//Read input file name

System.out.print("Enter input file Name: ");

inFile = scn.nextLine();

FileReader fr = new FileReader(new File(inFile));

BufferedReader br = new BufferedReader(fr);

System.out.println("Name \t\tService_Sold \tAmount \tEvent Date");

System.out.println("=====================================================");

line = br.readLine();

//Each line contains the following, separated by semicolons:

//The name of the client, the service sold

//(such as Dinner, Conference, Lodging, and so on)

while(line != null)

{

String temp[] = line.split(";");

for(int i = 0; i < temp.length; i++)

{

System.out.print(temp[i]+"\t");

if(i == 1)

System.out.print("\t");

}

//Calculate total amount for each service category

total += Double.parseDouble(temp[2]);

System.out.println();

line = br.readLine();

}

//Display total amount

System.out.println("\nTotal amount for each service category: "+total);

}

}

inputSale.txt:

Peter;Dinner;1500;30/03/2016

Bill;Conference;100.00;29/03/2016

Scott;Lodging;1200;29/03/2016

Output:

Enter input file Name: inputSale.txt

Name Service_Sold Amount Event Date

=====================================================

Peter Dinner 1500 30/03/2016

Bill Conference 100.00 29/03/2016

Scott Lodging 1200 29/03/2016

Total amount for each service category: 2800.0

3 0
3 years ago
Select the correct answer.
Mekhanik [1.2K]
The best answer is A
5 0
3 years ago
Read 2 more answers
After a conditional formatting rule is created using the ____ dialog box, the rule is then available for use in the database fro
Setler [38]

Answer:

New Formatting Rule.

Explanation:

Using New Formatting Rule the rule can be used in the database .Conditional formatting is used to highlight cells with different color according to the value of the cell. Conditional formatting can be done using formulas.In conditional formatting you can use if statements ,if else staements ,formulas etc.

5 0
3 years ago
A ____________object appears on a form as a button with a caption written across its face.
andrew-mc [135]

Answer:

Button is correct answer.

Explanation:

Button is the type of object that arrives on a form through the HTML Scripting Language. The programmer can use the button on the form for the submission of the page with the help of a button tag or input tag. They can also change the caption that is written on the button. So, that's why the following answer is correct.

4 0
3 years ago
Other questions:
  • What do you have to do to see the html code on a website?
    15·2 answers
  • What is the main purpose of cutting plane line arrows?
    7·1 answer
  • On his computer desktop, Rodney can see several different files, each immediately accessible. Because he is actively working on
    13·1 answer
  • Which of the following JavaScript expressions is equivalent to the given HTML code? ​ a. Document.getelementbyId("menu1").menu=
    6·1 answer
  • Jane receives an email claiming that her bank account information has been lost and that she needs to click a link to update the
    13·1 answer
  • When an external device becomes ready to be serviced by the processor the device sends a(n)_________ signal to the processor.
    8·1 answer
  • 1. Distinguish between
    7·1 answer
  • Find the unknown quantities
    12·1 answer
  • Write a pseudocode that receives a positive number from the user, and then,
    14·1 answer
  • try the following code to see a nullpointer error (if you don’t see the error because of the autograding, you can copy it into t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!