Define a single function named displayResults that returns nothing and takes two input parameters, an array of counters and the singular counter for the number of doubles rolled. The function displays the estimated probability of rolling doubles as well as the estimated probability of rolling each of the potential values from 1 to the maximum number that can be rolled (which can be calculated from the aforementioned input parameters). Recall, estimated probability is the calculated estimate of the theoretical probability of a scenario. To calculate an estimated probability we take the number of occurrences for a scenario and divide by the number of possible occurrences (the number of simulations).

Answers

Answer 1

Answer:

The function in Java:

public static void displayResult(int outcomes[], int n){

   System.out.println("Occurrence\tEstimated Probability");

   for(int x : outcomes){

       double prob = x/(double)n;

       prob = Math.round(prob * 100000.0) / 100000.0;

       System.out.println(x+"\t\t"+prob);

   }

}

Explanation:

See attachment 1 for complete question

This defines the function

public static void displayResult(int outcomes[], int n){

This prints the header

   System.out.println("Occurrence\tEstimated Probability");

This iterates through the outcomes

   for(int x : outcomes){

This calculates the probability

       double prob = x/(double)n;

The probability is then rounded to 5 decimal places

       prob = Math.round(prob * 100000.0) / 100000.0;

This prints each occurrence and the estimated probability

       System.out.println(x+"\t\t"+prob);

   }

}

See attachment 2 for complete program which includes the main

Define A Single Function Named DisplayResults That Returns Nothing And Takes Two Input Parameters, An

Related Questions

Create each of the following as separate classes: Room, Beds, Bath, Suite, SubRoom. Create a single RoomOrSuite class with the instance variables int numBeds, boolean hasBath, and int numSubrooms. Create a Suite class with the instance variables int numBeds, boolean hasBath, and int numSubrooms. Create a subclass Room of Suite which will inherit the instance variables numBeds and hasBath from Room, but not the instance variable int numSubrooms. Create a Room class with the instance variables int numBeds, and boolean hasBath. Create a subclass Suite of Room which will inherit the instance variables of Room and has an additional instance variable int numSubrooms. Create a Room class with the instance variables int numBeds, and boolean hasBath. Create a separate class Suite with the instance variable int numSubrooms.

Answers

Answer:

Explanation:

The following is written in Java and creates each one of the classes as requested. They can be used as seperate files within the same package but for the sake of simplicity, I am adding them together in this answer.

class RoomOrSuite {

   int numBeds;

   boolean hasBath;

   int numSubrooms;

}

class Room {

   int numBeds;

   boolean hasBath;

}

class Beds {

}

class Bath {

}

class Suite {

   int numBeds;

   boolean hasBath;

   private int numSubrooms;

}

class SubRoom {

}

class RoomOfSuite extends Room{

}

class SuiteOfRoom extends Room {

   int numSubrooms;

}

what are the charactaristic of computer with virus​

Answers

Explanation:

One of the main characteristics of computer viruses is related to the fact that they are programs created by hackers that attack the code of a computer, infecting files on the computer's hard drive or its source code. Once the virus has been copied onto the computer, it can contaminate other computers that come into contact with the machine.

A computer virus is any sort of malware, that when executed, copies its source code and then injects itself into other applications. This process then repeats itself over and over again. What the virus does from here can be many things. The virus can act as a keylogger to steal private information, it could also infect your hard drive and secretly upload your files to a server decided by the creator of the virus.

Write a program that has the user input how many classes they are taking this semester and then output how many hours they will need to study each week. Assume that they need to study five hours per week for each class that they take.

Answers

This is for Python

class_amt = int(input('Amount of Classes: '))

hours = class_amt * 5

print(f'You need to study for {hours} hours every week')

The program that has the user input on how many classes they are taking this semester is written in python.

What is programming?

Writing code to support certain activities in a computer, application, or software program and giving them instructions on how to do is known as computer programming.

It is well known that one of the hardest subjects to master is programming. It is not difficult to understand why some people find it challenging to learn how to code given how different it is from conventional educational methods, including college degrees in computer science. In general, programming is a calm profession.

class_amt = int(input('Amount of Classes: '))

hours = class_amt * 5

print(f'You need to study for {hours} hours every week')

Therefore, the codes are written above.

To learn more about programming, refer to the link:

https://brainly.com/question/16850850

#SPJ2


10. List three adaptations of wind-pollinated plants to promote pollination.

Answers

Answer:

No bright colors, special odors, or nectar.

Small.

Most have no petals.

Why is it important that you cite your sources?

Answers

Answer:

1. It gives credit to the authors/creators who's work you used.

2. Allows people who read your work a way find your sources if they want to learn more.

Emanuel studies hard for hours on end until bedtime, yet his grades could be better. What can he do to improve his academic performance?

sleep less
take breaks
eat more
work longer

Answers

Emanuel needs to Take breaks

Answer:

Its B! I know I'm late but for the other people that might get the same question like me.

Critiquing design: for each of these teapots , finish the statement last on the right that critique the object design

Answers

Answer:

Hey you have to add your own opinion. Like What you like about the teapot. what you wish was different. And What if meaning if it was changed how would it differ.

Explanation:

I like the design or this teapot. I wish it was made a little different. What if it was made different, it would be of more use and better to me.

Write a program to prompt the user to enter a fist name, last name, student ID and GPA. Create a dictionary called Student1 with the data. Repeat this for three students and create Student2 and Student3 dictionaries. Store the three students dictionaries to a new dictionary called ClassList. (ClassList will have Student1, Student2 and Student3 as sub dictionaries). Print out the ClassList. Then remove the GPA and print ClassList again.

Answers

Answer:

Answered below

Explanation:

#Program is written in Python

first_name = input ("Enter first name: ")

last_name = input ("Enter last name:")

student_id = int(input("Enter your ID"))

gpa = float(input ("Enter your GPA: "))

student1 = {}

student1["first_name"] = first_name

student1["last_name"] = last_name

student1["student_id"] = student_id

student1["gpa"] = gpa

//Repeat same code for student2 and student3

class_list = {"student1": {"first_name":"joy","last_name":"Son","student_id":"1","gpa":"3.5"},

#Fill in for student 2 and 3}

#To remove GPA for all students

del class_list["student1"]["gpa"]

del class_list["student2"]["gpa"]

del class_list["student3"]["gpa"]

print(class_list)

Amed is utilizing a feature that will use two tables. The first table contains a primary key matched to a foreign key in the second table. The query results will include all entries from the first table. Which feature is he using?

A. left outer join
B. right outer join
C. self join
D. inner join

(edge 2021)

Answers

Based on the above, the feature that Amed is using is left outer join. Check more about the terms below.

What is a primary key?

A primary key is known to be a primary keyword that is said to be a key one can find in a relational database made specially for each record.

Note that Based on the above, the feature that Amed is using is left outer join as it will help him to carryout the operations well.

Learn more about primary key  from

https://brainly.com/question/12001524

#SPJ2

Answer: its A

Explanation:

Which descnptons are examples of Logistics Planning and Management Services workers? Check all that apply.
a. Lucreta supervises workers who organize the products in a warehouse b. Jeff organizes the redevelopment of areas contaminated by pollution.
c. Beatrice sells tickets to passengers for trips, and advises them about travel routes
d.Stephane inspects vencies and equipment to make sure they meet safety standards
d. Marcel oversees the transportation activities of an organization
e. Armand analyzes procedures for shipping and storage to identify ways to make them more efficient.​

Answers

Answer:

The following below are descriptions of Logistics Planning and Management Services workers:

a. Lucreta supervises workers who organize the products in a warehouse

c. Beatrice sells tickets to passengers for trips, and advises them about travel routes

d.Stephane inspects vencies and equipment to make sure they meet safety standards

d. Marcel oversees the transportation activities of an organization

Explanation:

The catch clause ________. follows the try clause contains code to gracefully handle the exception type listed in the parameter list starts with the word catch followed by a parameter list in parentheses containing an ExceptionType parameter variable The catch clause does all of these

Answers

Answer:

all of these

Explanation:

The catch clause satisfies the following:

1. It starts with the word catch followed by a parameter list in parentheses containing an Exception Type parameter variable.

2. It follows the try clause.

3. It contains code to gracefully handle the exception type listed in the parameter list.

So, option ''all of these'' is correct

3. Carmen Villa runs a cooking blog, where she posts a new recipe each day. She wants to get a sense
of where her visitors are from, so she can choose recipes from the areas where her website visitors
live. What other site usage information might she be able to gather, and how can she use it to
improve the cooking blog for her visitors?

Answers

Answer:

im kinda confused on this question is ther a answer key

Explanation:

An entrepreneur wants to make an app to show what breeds of dogs are similar to each other. She wants to look at factors such as weight and energy level in her comparison. In the end, she wants each breed of dog to belong to a certain category based on these characteristics. What would be a sensible approach to solving this problem using clustering?

Answers

Answer

Dog breeds = observations, Average weight and energy level for each breed = variables. Each cluster is a category.

Explanation:

Using a method of clustering, she would be putting the dog breeds that are more similar together and in order to do this she has to look at various factors such as observation which are the dog breeds, and the average weight and energy level of the breeds, which represents variables. Every one of these clusters would be a category.

please help me with this coding problem :)

Consider the following field and incomplete method of some class. The method calcTotal is intended to return the sum of all values in vals.

private int[] vals;

public int calcTotal()
{
int total = 0;

/* missing code */

return total;
}
Which of the code segments shown below can be used to replace /* missing code */ so that calcTotal will work as intended?

I.
for (int i : vals)
{
total += i;
}
II.
for (int pos = vals.length; pos > 0; pos--)
{
total += vals[pos];
}
III.
int pos = 0;
while (pos < vals.length)
{
total += vals[pos];
pos++;
}


I only
II only
I and III
II and III
III only

Answers

Answer:

ll and lll

Explanation:

list dont be a looser

Write a method that reverses the sequence of elements in an array. For example, if you call the method with the array g

Answers

Hope it will help you

write a function that returns a list, where each member of list contains previous day’s value multiplied by 2.​

Answers

Answer:

Explanation:

The following code is written in Java, the function takes in a list with the previous day's values. The function then uses that list, loops through it and multiplies each individual value by 2 and returns the modified list. The first red  square represents the test case for the function, while the second red square in the image represents the output.

 public static ArrayList<Integer> doubleIt(ArrayList<Integer> mylist) {

       for (int x = 0; x<mylist.size(); x++) {

           mylist.set(x, mylist.get(x)*2);

       }

       return mylist;

   }

PLS HELP <3 Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.

var a = 0;

var b = 1;

var c

for(i = 1; I <= 5; i++)

{

C = a +b;

a = b;

b = c;

}

document. write(c);

The output of the document. write statement is ____?

Answers

Answer:

The output of the document. write statement is

Explanation:

Initially: [tex]a = 0[/tex] and [tex]b = 1[/tex]

The iteration is repeated 5 times and the calculation is as follows:

First iteration:

[tex]c = a + b =0 + 1 = 1[/tex]:=> [tex]c = 1[/tex]

[tex]a = b[/tex]:=> [tex]a= 1[/tex]

[tex]b = c[/tex]:=>[tex]b = 1[/tex]

Second iteration:

[tex]c = a + b =1 + 1 = 2[/tex]:=> [tex]c = 2[/tex]

[tex]a = b[/tex]:=> [tex]a= 1[/tex]

[tex]b = c[/tex]:=>[tex]b = 2[/tex]

Third iteration:

[tex]c = a + b =1 + 2= 3[/tex]:=> [tex]c = 3[/tex]

[tex]a = b[/tex]:=> [tex]a= 2[/tex]

[tex]b = c[/tex]:=>[tex]b = 3[/tex]

Fourth iteration:

[tex]c = a + b =2 + 3= 5[/tex]:=> [tex]c = 5[/tex]

[tex]a = b[/tex]:=> [tex]a= 3[/tex]

[tex]b = c[/tex]:=>[tex]b = 5[/tex]

Fifth iteration:

[tex]c = a + b =3 + 5= 8[/tex]:=> [tex]c = 8[/tex]

[tex]a = b[/tex]:=> [tex]a= 5[/tex]

[tex]b = c[/tex]:=>[tex]b = 8[/tex]

End of iteration

document. write(c) prints the value of c which is 8

Y’all what’s some celebrities that have kids??

Answers

Answer:

Angelina Jolie

Parents: Jon Voight, Marcheline Bertrand

Eddie Murphy

Parents: Charles Edward Murphy, Lillian Murphy

Sandra Bullock

Parents: Helga Meyer, John W. Bullock

Kate Hudson

Parents: Goldie Hawn, Bill Hudson

Katie Holmes

Parents: Kathleen A. Stothers-Holmes, Martin Joseph Holmes, Sr.

Reese Witherspoon

Parents: Betty Reese, John Witherspoon

Meryl Streep

Parents: Harry William Streep, Jr., Mary Wolf Wilkinson

Oprah Winfrey

Parents: Vernon Winfrey, Vernita Lee

Tina Fey

Parents: Zenobia Xenakes, Donald Fey

Uma Thurman

Parents: Nena von Schlebrügge, Robert Thurman

David Beckham

Parents: David Edward Alan Beckham, Sandra Georgina West

Susan Sarandon

Parents: Leonora Marie Criscione, Phillip Leslie Tomalin

Sofía Vergara

Parents: Julio Enrique Vergara Robayo, Margarita Vergara Dávila de Vergara

Hilary Duff

Parents: Susan Colleen Duff, Robert Duff

Miley Cyrus

Parents: Billy Ray Cyrus, Tish Cyrus

Zoë Kravitz

Parents: Lisa Bonet, Lenny Kravitz

Beyoncé

Parents: Tina Knowles, Mathew Knowles

Alexis Bledel

Parents: Nanette Bledel, Martin Bledel

Hugh Grant

Parents: Finvola Grant, James Grant

Britney Spears

Parents: Lynne Spears, Jamie Spears

Cindy Crawford

Parents: Jennifer Sue Crawford-Moluf, John Crawford

Adele

Parents: Penny Adkins, Mark Evans

Gwyneth Paltrow

Parents: Blythe Danner, Bruce Paltrow

Solange Knowles

Parents: Tina Knowles, Mathew Knowles

Which of the following statements is true for DMA: (only one correct answer) A. In DMA, Processor checks status until the operation is complete B. In DMA, Processor is interrupted when I/O module ready to execute data C. In DMA, no interrupt is produced D. In DMA, interrupt is sent when the task is completed E. None of the above

Answers

Answer:

D. In DMA, interrupt is sent when the task is completed

Explanation:

Note, the term Direct Memory Access simply refers to a computer feature that allows hardware subsystems to directly access the main system memory of a computer, without any the aid of the central processing unit (CPU).

It is a fact that while the transfer process is ongoing, an interrupt (interrupt signal) is not sent until when the task is completed.

Differentiate between computer engineering and software engineering

Answers

Answer:

Computer engineering is the field in tech that actually involves computers themselves. Software engineering is coding/designing software that runs on computers

Explanation:

In the range D5:D9 on all five worksheets, Gilberto wants to project next year's sales for each accessory, rounded up to zero decimal places so the values are easier to remember. In cell D5, enter a formula using the ROUNDUP function that adds the sales for batteries and chargers in 2021 (cell B5) to the sales for the same accessories (cell B5) multiplied by the projected increase percentage (cell C5). Round the result up to 0 decimal places. Fill the range D6:D9 with the formula in cell D5.
I just need the formula!!
A B C D
5
Batteries and chargers $ 123,274.42 1.50% $ 125,124

Answers

Answer:

Enter the following in D5:

=ROUNDUP((SUM(B5,B5)*C5),0)

Explanation:

Required

Add up B5 and B5, then multiply by C5.

Save result rounded up to 0 decimal places in D5

The required computation can be represented as:

D5 = (B5 + B5) * C5 [Approximated to 0 decimal places]

In Excel, the formula is:

=ROUNDUP((SUM(B5,B5)*C5),0)

Analyzing the above formula:

= ---> This begins all excel formulas

ROUNDUP( -> Rounds up the computation

(SUM(B5,B5) ---> Add B5 to B5

*C5) --> Multiply the above sum by C5

,0) ---> The computation is rounded up to 0 decimal places

To get the formula in D6 to D9, simply drag the formula from D5 down to D9.

The resulting formula will be:

=ROUNDUP((SUM(B6,B6)*C6),0)

=ROUNDUP((SUM(B7,B7)*C7),0)

=ROUNDUP((SUM(B8,B8)*C8),0)

=ROUNDUP((SUM(B9,B9)*C9),0)

Answer:

=ROUNDUP((SUM(B5)+(B5)*C5),0)

Explanation:

I followed Mr. Royal's explanation but the numbers just would not match.

I adjusted and used the formula above in cell D5 and I was able to get the correct sum.

Monster Collector
Write this program using an IDE. Comment and style the code according to the CS 200 Style Guide. Submit the source code files (.java) below. Make sure your source files are encoded in UTF-8. Some strange compiler errors are due to the text encoding not being correct.
Monster collector is a game of chance, where the user tries to collect monsters by guessing the correct numbers between 1 and 5. If the user doesn't guess the incorrect number, you catch the monster, otherwise, it gets away!
Example output:
Welcome to Monster Collector, collect 2 monsters to win!
A wild pikamoo appears! Guess a number between 1 and 5
5
You almost had it, but the monster escaped.
A wild bulbaroar appears! Guess a number between 1 and 5
1
Congratulations, you caught bulbaroar!
There are no more monsters to encounter!
You caught i monsters of 2
Keep training to be the very best!
Welcome to Monster Collector, collect 2 monsters to win!
A wild pikamoo appears! Guess a number between 1 and 5
3
Congratulations, you caught pikamoo !
A wild bulbaroar appears! Guess a number between 1 and 5
1
Congratulations, you caught bulbaroar!
There are no more monsters to encounter!
You caught 2 monsters of 2
You're the monster collector master!
A more detailed explanation of the requirements for each method will be in the method header comments - please follow these closely. Suggested order of completion:getMonster(), catchMonster(), printResult() then main(). Config.java contains an array of monsters, and the seed for your random number generator.

Answers

Answer:

In java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int monsternum, usernum;

 int count = 0;

 Random rand = new Random();

 String [] monsters = {"wild pikamoo","wild bulbaroar"};

 for(int i =0;i<2;i++){

     monsternum = rand.nextInt(5);  

     System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");

     usernum = input.nextInt();

     if(monsternum == usernum){      count++;      System.out.println("Congratulations, you caught a "+monsters[i]+"!");  }

 else{      System.out.println("You almost had it, but the monster escaped.");  }

 

 }

 System.out.println("There are no more monsters to encounter!");

 System.out.println("You caught "+count+" monsters of 2");

 if(count!=2){      System.out.print("Keep training to be the very best!");  }

 else{      System.out.print("You're the monster collector master!");  }

}

}

Explanation:

This declares monster and user number as integers

 int monsternum, usernum;

Initialize count to 0

 int count = 0;

Call the random object

 Random rand = new Random();

Create a string array to save the monster names

 String [] monsters = {"wild pikamoo","wild bulbaroar"};

Iterate for the 2 monsters

 for(int i =0;i<2;i++){

Generate a monster number

     monsternum = rand.nextInt(5);  

Prompt the user to take a guess

     System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");

Get user guess

     usernum = input.nextInt();

If monster number and user guess are equal, congratulate the user and increase count by 1

     if(monsternum == usernum){      count++;      System.out.println("Congratulations, you caught a "+monsters[i]+"!");  }

If otherwise, prompt the user to keep trying

 else{      System.out.println("You almost had it, but the monster escaped.");  }  

 }

Print no monsters again

 System.out.println("There are no more monsters to encounter!");

Print number of monsters caught

 System.out.println("You caught "+count+" monsters of 2");

Print user score

 if(count!=2){      System.out.print("Keep training to be the very best!");  }

 else{      System.out.print("You're the monster collector master!");  }

evaluate the arithmetic expression 234+567​

Answers

Answer:

801

Explanation:

234 + 567 = 801

Peyton is taking a part-time job to earn some extra money. Every week the manager will provide a list of tasks and the number of hours each task requires. The tasks have to be done one by one from the first one and Peyton would do so until the time spent on all finished tasks exceeds 10 hours. Please construct a function take_tasks, which takes one integer list as the argument task_hours and prints out how many hours and how many tasks Peyton would do for that week. For example, the program below
tasks ([2, 1, 3, 1, 4, 2, 3])
will have the following output:
Finish 5 tasks in 11 hours
Note: you can use enumerate() to get the index of the task, which is available after the for loop terminates. However, keep in mind that index starts from 0.
time_spent = 0
time_spent = 10
if time_spent > 10: break
if time_spent > 0: break
for index, hour in task_hours:
print('Finish {} tasks in {} he
if time_spent == 10: break
def take_tasks (task_hours):
time_spent += index
time_spent += hour
for index, hour in enumerate

Answers

Answer:

The function is as follows:

def tasks(Petyontasks):

   timespent = 0

   for i, tsk in enumerate(Petyontasks):

       if timespent<=10:

           timespent+=tsk

       else:

           break

   print("Finish "+str(i)+" tasks in "+str(timespent)+" hours")

Explanation:

The program in the question cannot be traced. Hence, the need to begin from scratch.

This defines the function

def tasks(Petyontasks):

This initializes timespent to 0

   timespent = 0

This iterates through the tasks [i represents the count of the tasks while tsk represents the time on each task]

   for i, tsk in enumerate(Petyontasks):

If timespent is less or equal to 10

       if timespent<=10:

The tasks is added and the timespent is calculated

           timespent+=tsk

If otherwise

       else:

The loop is exited

           break

This prints the required output

   print("Finish "+str(i)+" tasks in "+str(timespent)+" hours")

Explain the derived data types in C language with examples each

Answers

Answer:

Array, pointers, struct, and union are the derived data types.

Find the number of ways in which a committee of 4 can be chosen from six boys and
six girls if it must contain at least one boy and one girl.​

Answers

Answer:

465 ways

Explanation:

Atleast 1 girl and 1 boy

Possible combinations :

1 girl ; 3 boys = 6C1 ; 6C3

2 girls ; 2 boys = 6C2 ; 6C2

3 girls ; 1 boy = 6C3 ; 6C1

(6C1 * 6C3) + (6C2 * 6C2) + (6C3 * 6C1)

Combination formula:

nCr = n! ÷ (n-r)!r!

We can also use a calculator :

6C1 = 6

6C3 = 20

6C2 = 15

Hence,

(6C1 * 6C3) + (6C2 * 6C2) + (6C3 * 6C1)

(6 * 20) + (15 * 15) + (20 * 6)

120 + 225 + 120

= 465 ways

third mean between two numbers 27 and 1 by 27 is 1 find the number of means​

Answers

Answer:

third mean between two numbers 27 and 1 by 27 is 1 find the number of means​

Explanation:

01110100 01101000 01101001 01110011 00100000 01110011 01110101 01100011 01101011 01110011 00100000 01100010 01100001 01101100 01101100 01110011 00100000 01110101 00100000 01100010 01101001 01110100 01100011 01101000 01100101 01110011

Answers

Answer:

01110101 01101110 01101111 00100000 01110010 01100101 01110110 01100101 01110010 01110011 01100101 00100000 01100011 01100001 01110010 01100100 00100000 01000010 01000101 01010100 01000011 01001000

Suppose users share a 25 Mbps link. Also suppose each user transmits continuously at 5 Mbps when transmitting, and each user transmits only 20 percent of the time. When circuit switching is used, how many users can be supported

Answers

Answer:

Two users have been supported as each user has half of the link bandwidth.

Explanation:

Two users require 1Mbps when transmitting, and fewer users transfer a maximum of 2 Mbps, and the available bandwidth of the shared link is 2 Mbps; there will be no queuing delay before connection. If three users, transmit, then bandwidth will be 3Mbps, and there will be queuing delay before the link. Link size = 2Mpbs, i.e. two users ,transmit, then a maximum of 2Mbps will require and does not exceed 2Mbps of bandwidth.

Consider the following class definitions. public class Computer { private String memory; public Computer) { memory = "RAM"; } public Computer (String m) { memory = m; } public String getMemory () { return memory; ) } public class Smartphone extends Computer private double screenWidth, screenHeight; public Smart Phone (double w, double h) super("flash"); screenWidth = w; screenHeight = h; } public double get ScreenWidth() { return screenWidth; } public double getScreenHeight() { } return screenHeight; } The following code segment appears in a class other than Computer or Smartphone. + Computer myPhone = new Smart Phone (2.55, 4.53); System.out.println("Device has memory: " + myPhone.getMemory () ", screen area: " + myPhone.getScreenWidth()* myPhone.getScreenHeight() + " square inches."); The code segment is intended to produce the following output. Device has memory: flash, screen area: 11.5515 square inches. Which of the following best explains why the code segment does not work as intended?A. An error occurs during compilation because a Smartphone object cannot be assigned to the Computer reference variable myPhone. B. An error occurs during compilation because the Smartphone class has no getMemory method. C. An error occurs during compilation because the getScreenWidth and getScreenHeight methods are not defined for the Computer object myPhone. D. An error occurs at runtime because the Smartphone class has no getMemory method. E. An error occurs at runtime because the getScreenWidth and getScreenHeight methods are not defined for the Computer object myPhone.

Answers

Answer:

C.

Explanation:

The code provided in the question has many syntax errors. I have pasted a fixed version of the code below that fixes all the syntax errors but leaves the code as is. Using this code you can see that the error that is preventing the code from running properly is that

C. An error occurs during compilation because the getScreenWidth and getScreenHeight methods are not defined for the Computer object myPhone.

As you can see from the attached photo below, the code is failing to compile because the methods themselves are not able to be accessed by the myPhone object. This is happening during the compilation and thus causing the compilation to fail.

class Computer {

   private String memory;

   public Computer() {

       memory = "RAM";

   }

   public Computer(String m) {

       memory = m;

   }

   public String getMemory() {

       return memory;

   }

}

   class Smartphone extends Computer {

       private double screenWidth, screenHeight;

       public Smartphone(double w, double h) {

           super("flash");

           screenWidth = w;

           screenHeight = h;

       }

       public double getScreenWidth() {

           return screenWidth;

       }

       public double getScreenHeight() {

           return screenHeight;

       }

   }

   public class Main{

       //The following code segment appears in a class other than Computer or Smartphone

       

       public static void main(String[] args) {

           Computer myPhone = new Smartphone(2.55, 4.53);

           System.out.println("Device has memory: " + myPhone.getMemory() + ", screen area: " + (myPhone.getScreenWidth()*myPhone.getScreenHeight()) +" square inches.");

       }

   }

The choice is "The getScreenWidth and getScreenHeight methods again for Computer object myPhone aren't declared, resulting in an error during compilation".

Class Description:

In Options D and E errors would not occur since only compile-time errors, not run-time errors, would happen.

Computer myPhone = new Smartphone(2.55,4.55);

A computer class was referenced by myPhone in this line. As a consequence, it's solely useful for computer students. Therefore, if you try to use the "getScreenwidth" and "getScreenHeight" functions of both the Smartphone class, which would be a sub-class of the Smartphone, you'll get an error. So, because the scope of the myPhone is limited to the parent class, the computer, it complies.Choices A and B will not produce an error since they are inside the scope of the myPhone.As a result, option C is the best argument for why the code section isn't working as it should.

Find out more about the class here:

brainly.com/question/17001900

Other Questions
How did the annexation of Texas help contribute to the Civil War? A) The issue of admitting Texas as a slave state contributed to the conflict that caused the Civil War. B) Texans had nothing in common with U.S. citizens. The cultural differences made annexation difficult. C) Adding Texas as a state created an imbalance between southern and northern territories in terms of size. D) Texas was predominately Catholic, while the rest of America was Protestant. Adding Texas created religious conflict. I need help in the answer its math A grocer wants to mix two kinds of coffee. One kind sells for $1.00 per pound, and the other sells for $2.55 per pound. He wants to mix a total of 28 pounds and sell it for $1.35 per pound. How many pounds of each kind should he use in the new mix? (Round off the answers to the nearest hundredth.) 2.1 Define the meaning of the phrase entry requirements to higher educationinstitutions and state FOUR reasons why knowing the entry requirements isimportant. Professor Smith decides to track the dating behaviors of college students throughout their college careers. She decides to begin her research using her introductory class. After explaining the study, she assures students that their responses will be kept confidential. The students complete her survey during class. Her research most clearly impinges on: A. deception. B. analysis and reporting of the data. C. voluntary participation D. the value placed on anonymity E. value-free reports of the data. Do authoritarian governments exist today?. Yes, countries act as authoritarian governments such as North Korea. Yes, countries act as authoritarian governments such as ArgentinaNo, countries may look like authoritarian governments but they are actually not. No, it is impossible to be an authoritarian government Josiah had 128 toy cars. If he organizes them into groups of 7 , how many cars will be in the final group? 2 EASY QUESTIONS HELP In the Dred Scott decision, why did the Supreme Court say that slave owners could legally take their slaves into any territory or state in the United States? If a printer can print 68 lines in per minute how many lines can it print in an hour? (hint: 1 hour=60 minutes) A rectangular city lot has an area of 1,000 square meters. If the length of the lot is 10 meters more than twice its width, find the length and width. Write the quadratic equation.PLS I NEED THIS FOR AN RA PLSSS HELPPPP I WILLL GIVE YOU BRAINLIEST!!!!!! PLSSS HELPPPP I WILLL GIVE YOU BRAINLIEST!!!!!! PLSSS HELPPPP I WILLL GIVE YOU BRAINLIEST!!!!!! PLSSS HELPPPP I WILLL GIVE YOU BRAINLIEST!!!!!!PLSSS HELPPPP I WILLL GIVE YOU BRAINLIEST!!!!!! PLSSS HELPPPP I WILLL GIVE YOU BRAINLIEST!!!!!! PLSSS HELPPPP I WILLL GIVE YOU BRAINLIEST!!!!!! hiii please help ill give brainliest thanks You are making lemonade. The amount of sugar you need depends on the amount of lemonade mix you use. Cups of sugar \dfrac13 3 1 start fraction, 1, divided by, 3, end fraction 111 333 Packets of lemonade mix 111 333 999 Is the amount of sugar you need proportional to the amount of lemonade mix you use? Jamil has $62.67 in his saving account. His grandma gave him $5.00 for mowing the lawn and $.75 for taking out the garbage. How much money does Jamil have altogether? The models below represent nuclear reactions. The atoms on the left of the equal sign are present before the reaction, and the atoms on the right of the equal sign are produced after the reaction. Model 1: Atom 1 + Atom 2 = Atom 3 + energy Model 2: Atom 4 = Atom 5 + Atom 6 + energy Which of these statements is most likely correct about the two models? (2 points) Both models show reactions which produce energy in the sun. Both models show reactions which use up energy in the sun. Model 1 shows reactions in the nuclear power plants and Model 2 shows reactions in the sun. Model 1 shows reactions in the sun and Model 2 shows reactions in a nuclear power plant. How many grams of NaOH (MW = 40.0) are there in 500.0 mL of a 0.175 M NaOH solution?A) 3.50B) 114C) 14.0D) 2.19x10 24. Please type the correct conjugation for each verb. Make sure your answers are in lower caseincluding the first letter. The verb is necesitarEllas(1 Point)Enter your answer Jameson is writing about this excerpt from The Jungle Book."He is our brother in all but blood," Akela went on; "and ye would kill him here. In truth, I have lived too long. Some of ye are eaters of cattle, and of others I have heard that, under Shere Khan's teaching, ye go by dark night and snatch children from the villager's doorstep. Therefore I know ye to be cowards, and it is to cowards I speak. It is certain that I must die, and my life is of no worth, or I would offer that in the man-cub's place. But for the sake of the Honor of the Pack,a little matter that, by being without a leader, ye have forgotten,I promise that if ye let the man-cub go to his own place, I will not, when my time comes to die, bare one tooth against ye. I will die without fighting. That will at least save the Pack three lives. More I cannot do; but, if ye will, I can save ye the shame that comes of killing a brother against whom there is no faulta brother spoken for and bought into the Pack according to the Law of the Jungle.Jameson makes the claim "Akela teaches the importance of following Jungle Law.Which detail best supports this claim?He congratulates the Pack on following Shere Khans teachings and hunting in the village at night.He warns that, according to the Law, it is shameful to kill another Pack member who has done nothing wrong.He admits that his life is of no worth because he is old and offers to give his life for Mowgli.He tells that Pack that the Law of the Jungle is going to disappear if it is not obeyed. "Hurricanes and tornados are two of nature's destructive forces. 2Hurricanes bring high winds, high seas, and vast amounts of rain. High seasrip Into the shore line and cause massive flooding, while strong winds and rains can destroy homes, pull down power lines, and uproot trees.Tornados are no better. SThey can destroy a home, as easily as we pick up a snail, with their powerful wind funnel.Which numbered sentence is the topic sentence?.1 .2 .3D.4