Q1: Identify and correct the errors in each of the following pieces of code. [Note: There maybe more than one error in each piece of code. a) int x = 1, total; while (x <= 10) { total += x; ++x; } b) while (x <= 100) total += x; ++x; c) public class Mystery { public static void main(String[] args) { int x = 1; int total = 0; while (x <= 10) { int y = x * x; System.out.println(y); total += y; ++x; }// end of while System.out.printf("Total is %d%n", total); }//end of main }//end of class Mystery2 *********************** Q2 What does the following program print? public class Mystery3 { public static void main(String[] args) { int row = 10; while (row >= 1) { int column = 1; while (column <= 10) { System.out.print(row % 2 == 1 ? "<" : ">"); ++column; }// end of while column<=10 --row; System.out.println(); }//end of while }//end of main }// end of class Mystery3

Answers

Answer 1

Answer:

a. int x = 1, total = 0;

while (x <= 10){

 total += x;

 ++x;

}

b. while (x <= 100){

 total += x;

 ++x;

}

c. public class Mystery{

 public static void main(String[] args){

   int x = 1;

   int total = 0;

   while (x <= 10){

     int y = x * x;

     System.out.println(y);

     total += y;

     ++x;

   }

   System.out.printf("Total is %d%n", total);

}

Explanation:

For the first code, the variable "total" was not initialized, so to avoid raising an error message, an integer value must be assigned to it before the increment. Code block two of the second while statement must be enclosed in curly braces, while the third code must be indented properly.


Related Questions

If we use 6 bits for representing positive and negative numbers using 2's
complement methods, what is the value of 11100?

Answers

Answer:

-4


Explanation:
In binary, 11100 is 28
But in the two’s complement method, it will equals = (-4).
the last number always represents negative number.
In other words, if this (101010) with 6 digits. Without using two’s complement method, it would be 42 in binary. But with two’s complement method, it would ( - 22)


I hope this helps. Please don’t hesitate to ask if u concerning my answer
Yeeeeeeeeeeeeeeeeeeeeeeee

Implement the ArrayMethod application containing an array that stores eight integers. The application should call the following five methods: 1. display - should display all the integers 2. displayReverse - should display all the integers in reverse order 3. displaySum - should display the sum of the integers 4. displayLessThan - should display all values less than a limiting argument 5. displayHigherThanAverage - should display all values that are higher than the calculated average value.

Answers

Answer:

public static void display(int [] arr){

   System.out.print("Arrays: ");

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

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static void displayReverse (int [] arr){

   System.out.print("Arrays in reverse order: ");

       for(int i=arr.length-1;i>=0;i--){

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static int displaySum (int [] arr){

   System.out.print("Sum: ");

   int sum = 0;

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

           sum+=arr[i];

       }

       return sum;

   }

   

public static void displayLessThan (int [] arr, int num){

       System.out.print("Less than "+num+": ");

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

           if(arr[i]<num){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

public static void displayHigherThanAverage  (int [] arr){

       System.out.print("Higher than average: ");

       int sum = 0;

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

           sum+=arr[i];

       }

       float average = sum/arr.length;

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

           if(arr[i]>average){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

Explanation:

The methods were written in Java. See attachment for explanation where I used comments to explain each lines.

Note that lines that begin with double slash (//) are comments

what percent of records are temporary, if you are not in the OSD?​

Answers

Answer:

Headed by the OSD Records Administrator, the OSD Records and Information Management (RIM) Program is responsible for oversight, implementation of the Federal Records Act within the Offices of the Secretary of Defense and the WHS supported Defense Agencies and Field Activities.

Explanation:

Please help,it’s a year 9 question

Answers

Answer:

For an AND gate, Q would be 0,0,0,1 respectively.

See the reference table below.

In a block of addresses we know the IP address of one host is Roll no. Roll no. Roll no. Roll no./20.What is the first address and the last address of this block? Find the number of addresses in the block?
Hint: if your roll no is 33 then your ip address will look like this: 33.33.33.33/20

Answers

Answer:

If there’s one topic that trips people up (both new and experienced) in the networking industry, it is that of Subnetting.

One of the reasons this happens is that one has to perform (mental) calculations in decimal and also binary. Another reason is that many people have not had enough practice with subnetting.

In this article, we will discuss what Subnetting is, why it came about, its usefulness, and how to do subnetting the proper way. To make this article as practical as possible, we will go through many examples.

Note: While subnetting applies to both IPv4 and IPv6, this article will only focus on IPv4. The same concepts explained here can be applied to IPv6. Moreover, subnetting in IPv6 is more of a want rather than a necessity because of the large address space.

IP address network

For example, any traffic with a destination IP address of 192.168.1.101 will be delivered to PC1, while traffic addressed to 192.168.1.250 will be delivered to SERVER.

Note: This is an oversimplification of things just for understanding sake and refers to Unicast (one-to-one) IPv4 addresses. Traffic sent to Multicast (one-to-many) and Broadcast (one-to-all) IP addresses can be delivered to multiple devices. Also, features like Network Address Translation (NAT) allow one IP address to be shared by multiple devices.

To help your understanding of IP addresses and subnetting, you need to resolve the following fact in your head: Computers think in binary, that is, 0s and 1s. Therefore, even though we see an IP address represented like 192.168.1.250, it is actually just a string of bits – 32 bits in total for IPv4 addresses.

To make them more readable for humans, IPv4 addresses are represented in dotted decimal notation where the 32 bits are divided into 4 blocks of 8 bits (also known as an octet), and each block is converted to a decimal number.

For example, 01110100 in binary is 116 in decimal:

A unicast IPv4 address such as 192.168.1.250 can be divided into two parts: Network portion and Host ID. So what does this mean? Well, IPv4 addresses were originally designed based on classes: Class A to Class E. Multicast addresses are assigned from the Class D range while Class E is reserved for experimental use, leaving us with Class A to C:

Class A: Uses the first 8 bits for the Network portion leaving 24 bits for host IDs. The leftmost bit is set to “0”.

Class B: Uses the first 16 bits for the Network portion leaving 16 bits for host IDs. The two leftmost bits are set to “10”.

Class C: Uses the first 24 bits for the Network portion leaving 8 bits for host IDs. The three leftmost bits are set to “110”.

Note: The range of Class A is actually 1-126 because 0.x.x.x and 127.x.x.x are reserved.

With these classes, a computer/device can look at the first three bits of any IP address and determine what class it belongs to. For example, the 192.168.1.250 IP address clearly falls into the Class C range.

Looking at the Host ID portion of the classes, we can determine how many hosts (or number of individual IP addresses) a network in each class will support. For example, a Class C network will ideally support up to 256 host IDs i.e. from 00000000 (decimal 0) to 11111111 (decimal 255). However, two of these addresses cannot be assigned to hosts because the first (all 0s) represents the network address while the last (all 1s) represents the broadcast address. This leaves us with 254 host IDs. A simple formula to calculate the number of hosts supported

Explanation: Final answer is Start address: 192.168.58.0 + 1 = 192.168.58.1

End address: 192.168.58.16 – 2 = 192.168.58.14

Broadcast address: 192.168.58.16 – 1 = 192.168.58.15

If you wanted to use the numeric key pad to multiply 8 and 5 and then divide by 2, you would type
1. 8/5*2
2. 5/2/8
3. 8*5*2
4. 8*5/2

Answers

Answer:

Option 4 would be your best answer

Explanation:

The * means multiply

And the / means Divide

Hope this helps :D

4) 8*5/2 would be the correct answer to your question

are used for mechanical power transmission over long distances
A. Spur Gears
B. Helical Gears
C. Planetary Gears
D. Chain and Sprockets

Answers

Answer:

D. Chain and Sprockets

Explanation:

Chains and sprockets are power transmission tools. The roller chain is connected to a toothed wheel which is the sprocket. The combination provides mechanical power to the wheels of vehicles.

An advantage they possess is their ability to transmit mechanical power over both short and long distances. They have a high degree of efficiency but they require constant lubrication. They also produce noise during operation.

of what is famous Ted Nelson?​

Answers

Answer:

Nelson proposed a system where copying and linking any text excerpt, image or form was possible.

Explanation:

Ted Nelson is one of the theoretical pioneers of the world wide web who is best known for inventing the concept of hypertext and hypermedia in the 1960s. As one of the early theorists on how a networked world would work.

How I know:

I goggle it.

Help fast

When comparing and what is the main difference?
O The first symbol is for reviewing text and the second for enlarging text.
The first symbol is for spacing and the second for sizing.
O The first symbol is for viewing text and the second for inserting text.
O The first symbol is for inserting text and the second for viewing text.

Answers

Answer:

The first symbol is for inserting text and the second for viewing text

Explanation:

PLZZ HELPP MEE!!

What projects would Excel best be used for? Be sure to say the name of the project and how you would go about creating it.

Answers

In my opinion, I believe Excel would be best used for any project really. But it will be most helpful when it comes down to reports and finance data and things like that. I would do something like how much income will I receive over the next few months to a year. And I will create a graph sowing my income for each month. But like I stated earlier, Excel is mainly used for graphs and almost every project has a graph so, it would actually be good for all things.

Hope this helps! :))

which of the following is not a benefit of aws cloud computing​

Answers

Answer: High latency, temporary and disposable resources are not the benefits of AWS cloud computing.

Explanation: AWS is the most reliable and broad platform that offers a wide range of feature services to individuals globally.

Hope this helps (:

HELP PLS
Which technologies have made global communication instant and more effective? Choose THREE answers.

social media
wireless devices
smart phones
automobiles
printed newspapers

Answers

Answer:

(1). social media

(2). wireless devices

(3). smart phones

Explanation:

The three technologies that have made global communication instant and more effective are social media, wireless devices, and smart phones.

Here,

Social media platforms have revolutionized the way people communicate globally. They allow individuals to connect, share information, and communicate with others in real-time, regardless of geographical location.

Wireless devices, such as laptops, tablets, and smartwatches, have eliminated the need for physical connections like cables and wires. They allow users to access the internet and communicate with others from virtually anywhere with a wireless signal.

Smartphones combine the features of a mobile phone with advanced computing capabilities. They provide instant communication through voice calls, text messages, emails, and various messaging apps.

Smartphones also allow users to access social media platforms and use wireless internet, making global communication more convenient and efficient.

Know more about communication technologies,

https://brainly.com/question/33037966

#SPJ6

Need help ASAP. Will mark brainliest!
Which of the following is assigned to every network device?

Digital address
Logical address
MAC address
Personal address

Answers

A feature which is assigned to every (all) network device is: C. MAC address.

What is a MAC address?

MAC address is an abbreviation for media access control address and it can be defined as a unique identifier that is generally assigned by manufacturers to a network interface controller (NIC) of every (all) network device, especially for use as a network address when the device is communicating with other network devices within a network segment.

This ultimately implies that, media access control address (MAC address) is a feature which is assigned to every (all) network device by the manufacturers.

Read more on MAC address here: https://brainly.com/question/25246068

Answer: MAC Address

Explanation: Took the test and it was right :)

Use the drop-down menus to complete statements about archiving and backing up data fileArchiving data files manages the size of a mailbox for storage.
Creating an Outlook data file
data files in storage on a computer.

Answers

Answer:

Archiving data files manages the size of a mailbox for  

local

storage.

Creating an Outlook data file  

protects

data files in storage on a computer.

Explanation:

Because its right.

Answer:

an increase in cloud computing

Explanation:

Other Questions
7 is 1/10 ofpls help and thank you :) why RNA is always single stranded and DNA is double stranded Evaluate the expression.3(6 -63)PLEASE HELP HELP ME PLZ !!! IT'S ALGEBRA 1. Who was the Roman Emperor who split the Roman Empire? What do you get when you plug 4 in the following function? Find the area of the triangle 19cm15cm12cm Write and simplify an expression for the area of the rectangle. Write the SIMPLIFIED answer in the text box. 15 men can dig a trench og 90m in 3 hours. how long will it take 16 men to dig a trench of 48m long? Because the cerebellum and cerebrum control movement and behavior, researchers began their investigation by studying the diseased cows' brains.Please select the best answer from the choices providedTF What is the volume of the prism 4. A surgical patient needs to have her liquid intake carefully monitored. How many mL of fluid did she consume if shedrankL of water, a pint of milk, and 8 oz of juice? 911406 con operaciones When shopping for a savings account you should look for one that offersannual fees loyal customer feessimple interest compounding interest Depenendent EventA box contains 6 yellow, 2 black and 4 green pencils. What is the probability of pulling two greenpencils (without replacement)? Write your answer as a decimal. (I'll give you brainliest I have a couple questions on my page! ) Galls theory suggested that the shape and characteristics of a persons skull offered insight into that persons personality. Which term BEST describes this study of the skull?A. phrenology.B. psychopathy.C. somatotyping.D. anthropology. Daniel bought a bag of marbles at the school garage sale it contains five red marbles four yellow marbles five Green marbles and to blue marbles marbles were all the same size and shape if Daniel reached into the bag and pulled out a marble without looking what is the probability it was not blue What is the total number of barrels of oil produced from solely asian nations? PICK ONE:500795.6789.7794.4 HELP PLSWhich technologies have made global communication instant and more effective? Choose THREE answers.social mediawireless devicessmart phonesautomobilesprinted newspapers Which of the following objects absorbs the most light?