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
bonufazy [111]
3 years ago
14

I need help to find out what is wrong with this program and my variable, "exponent" comes out as 0 in the output instead of the

number i typed, "3".

Computers and Technology
1 answer:
sweet-ann [11.9K]3 years ago
3 0

You're substracting one from the variable "exponent" with every iteration of the loop, and you told it to break out of the loop once "exponent" is 0, therefore, it's always going to end up as 0 at the end.


If you want to keep the input from the user, then declare another variable like "counter" and assign the value of "exponent" to it and use it for the loop


Or even better, do this for the loop:

for(int i = 0; i < exponent; i++)

{

//Code here

}

You might be interested in
Data will zip through a 5G network much faster than through a 4G network because of the 10-fold difference in _____.
Vlad [161]

Data will zip through a 5G network much faster than through a 4G network because of the 10-fold difference in latency.

<h3>What is 5G network ?</h3>

The 5G is known to be the fifth-generation technology standard that is often used for most broadband cellular networks.

Here, 5G networks will have lower latency when compared to 4G that is it is less than 1 ms than to 10 ms. This implies that data will zip via the network much faster.

Learn more about  5G network from

brainly.com/question/24664177

5 0
2 years ago
Write an exception class named InvalidTestScore. Modify the TestScores class you wrote in Part I so that it throws an InvalidTes
Elan Coil [88]

Answer:

See Explaination

Explanation:

package testscores;

import java.util.ArrayList;

import java.util.List;

public class TestScores {

public List<Integer> scorearray=new ArrayList<>();

public TestScores(List<Integer> scores) throws InvalidTestScore{

this.scorearray=scores;

for(int i=0;i<scorearray.size();i++){

if(scorearray.get(i)>100 || scorearray.get(i)<0){

throw new InvalidTestScore(this.scorearray.get(i));

}

}

}

public double average(){

int tot=0;

for(int i=0;i<this.scorearray.size();i++){

tot=tot+this.scorearray.get(i);

}

return tot*(1.0)/(this.scorearray.size());

}

class InvalidTestScore extends Exception

{

private double amount;

public InvalidTestScore(int Score)

{

System.out.println("Invalid Score "+Score);

}

}

}

8 0
4 years ago
Which layer includes the physical transmission medium (cables or wireless media) that any network must use to send and receive t
Yuliya22 [10]

Answer:

The correct answer to the following question will be "Physical Layer".

Explanation:

  • The lowest layer of the OSI reference model is the physical layer. It's in charge of having to send bits from one desktop to the next.
  • This layer isn't acquainted with the interpretation of the parts and is concerned with setting up a physical wireless connection and sending and receiving signals.
  • This layer relies on aspects of the hardware, such as wires, transmitters, and network interface tokens.

Therefore, it will be the right answer.

4 0
3 years ago
How many currencies do recognize?
klemol [59]
The United Nations currently recognizes 180 currencies that are used in 195 countries across the world the United States dollar is a popular currency and about 66 countries either peg their currency to the US dollar or use it as their currency
3 0
3 years ago
Lonnie has several workbooks that contain financial and sales data. He needs to ensure that if the data in a single cell in one
Rzqust [24]

Answer: Linked cell

Explanation: I just did a test

7 0
3 years ago
Other questions:
  • The _____ is the area in Microsoft Excel where you can perform file commands such as Save, Open, and Print
    15·1 answer
  • Conceptual note-taking is the act of
    15·1 answer
  • A modern information-processing model that views memories as emerging from particular activation patterns within neural networks
    6·1 answer
  • I WILL MARK BRAINLIEST PLZ HELP
    5·1 answer
  • GIVING BRAINLIEST Jenna creates advertisements for companies to air on television. Which file format will best preserve the grap
    5·2 answers
  • Why does my inbox keep getting notifications and then disappearing?
    15·2 answers
  • What is DMTS. Explain it​
    10·2 answers
  • The Uniform Electronic Transmission Act (UETA) a. declares that e-signatures are invalid. b. has only been adopted in a handful
    8·1 answer
  • When you login to your blogging account. The first screen with all controls, tools and functions is called .... Select one: a. D
    10·1 answer
  • Given a number n, for each integer i in the range from 1 to n inclusive, print one value per line as follows:
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!