Question # 4
Math Formula
What is the output of the following program?

for num in range(4):
print (num * 2)

Answers

Answer 1

The output will be:

0

2

4

6

This happens because the for loop iterates through the numbers in the range function and prints those numbers multiplied by two.


Related Questions

Create a games that simulates rolling of two dice by generating two random numbers between 1 and 6 inclusive. The chooses a number between 2 and 12 (the lowest and the highest total possible for two dice). The player than roll two dice up three times. If the number choose by user comes up, the user wins and games end. If the number does not come up within three rolls, the computer wins.

Answers

Here's a Python implementation of the game:

The Program

def roll_dice():

   return random.randint(1, 6), random.randint(1, 6)

def play_game():

   number_to_guess = random.randint(2, 12)

   print(f"Number to guess is {number_to_guess}")

   for i in range(3):

       dice1, dice2 = roll_dice()

       print(f"Roll {i+1}: {dice1}, {dice2}")

       if dice1 + dice2 == number_to_guess:

           print("You win!")

           return

   print("Computer wins.")

play_game()

The roll_dice function utilizes two random numbers which lie between a range of 1 to 6, and the play_game method engages in a round of the game by picking an arbitrary number on the 2 to 12 spectrum followed by rolling two dice up to three times so that the randomly chosen number might be revealed.

Should the aforementioned number become realized, the player shall emerge victorious; otherwise, it is the computer's turn to bask in glory. Finally, the result of the game is discussed through production to the console.

Read more about programs here:

https://brainly.com/question/23275071

#SPJ1

Changing the appearance of the text in your document, is to _________________ it.

Answers

Answer:

Format

Explanation:

I dont really know what the explanation would be but hope this helps.

What feature allows a person to key on the new lines without tapping the return or enter key

Answers

The feature that allows a person to key on new lines without tapping the return or enter key is called word wrap

How to determine the feature

When the current line is full with text, word wrap automatically shifts the pointer to a new line, removing the need to manually press the return or enter key.

In apps like word processors, text editors, and messaging services, it makes sure that text flows naturally within the available space.

This function allows for continued typing without the interruption of line breaks, which is very helpful when writing large paragraphs or dealing with a little amount of screen space.

Learn more about word wrap at: https://brainly.com/question/26721412

#SPJ1

If you convinced your teacher to give you an extension on an assignment, what would this situation be an example of? OA. Generalization O O B. Prediction C. Drawing conclusions D. Rhetoric

Answers

Answer:

D. Rhetoric

Explanation:

Just trust me....okay!?......okay

write a program that accepts three decimal numbers as input and outputs their sums?​

Answers

Answer:

The answer to this question is given below in the explanation section

Explanation:

The code is written in C++ language:

// Example program

#include <iostream>

#include <string>

using namespace std;

int main()

{

 double number [3];

 double addition=0;

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

 {

     cout<<"Enter decimal number at position " <<i+1< " ";

     cin>>number[i];

     addition= addition+ number[i];

           

     }

 cout<<"The addition is "<<addition;

}

Use the get_seconds function to work out the amount of seconds in 2 hours and 30 minutes, then add this number to the amount of seconds in 45 minutes and 15 seconds. Then print the result.

Answers

Answer:

Since the get_seconds function is not given, I'll implement it myself;

The full program (get_seconds and main) written in python is as follows:

def  get_seconds(hour,minute,seconds):

    seconds = hour * 3600 + minute * 60 + seconds

    return seconds

time1 = get_seconds(2,30,0)

time2 = get_seconds(0,45,15)

result = time1 + time2

print(result)

Explanation:

The get_seconds defines hour, minute and seconds as its arguments

This line defines the get_seconds function

def  get_seconds(hour,minute,seconds):

This line calculates the second equivalent of the time passed to the function

    seconds = hour * 3600 + minute * 60 + seconds

This line returns the the calculated seconds equivalent of time

    return seconds

The main starts here

This line calculates the number of seconds in 2 hours and 30 minutes

time1 = get_seconds(2,30,0)

This line calculates the number of seconds in 45 minutes and 15 seconds

time2 = get_seconds(0,45,15)

This line adds both together

result = time1 + time2

This line prints the result

print(result)

find the sum of odd number from 1 to 100 .with flowchart, pseudo code and program code​

Answers

Answer:

Flowchart:

START

Set sum = 0

Set i = 1

WHILE i <= 100

IF i % 2 == 1

Set sum = sum + i

END IF

Set i = i + 1

END WHILE

Display sum

STOP

Pseudo code:

sum = 0

for i = 1 to 100

if i % 2 == 1

sum = sum + i

end if

end for

display sum

Program code in Python:

python

sum = 0

for i in range(1, 101):

if i % 2 == 1:

sum += i

print(sum)

Output: 2500

Explanation:

The program initializes the sum variable to 0 and uses a for loop to iterate through the numbers 1 to 100. The if statement checks if the current number is odd (i % 2 == 1) and if so, adds it to the sum variable. Finally, the program displays the sum of all odd numbers from 1 to 100, which is 2500.

Problem 1 a = 4 b = 3 c = 20 while a < c a = a * 2 b = b * 3 Endwhile output a, b, c

Answers

Endwhile output is a = 4, b = 12, c = 20.

What is input and output?
Data must be added to or subtracted from code in all programmes. Inputs are the data that are entered into a programme, whether manually by the programmer or digitally. These inputs are used to run the programme and are saved as variables. A programmer may decide to include outputs to inform the user of what is happening inside the programme. Here, the user is presented with the program's data either visually (on the screen) or physically (as printouts or signals, for example). It's possible that a programme needs to talk to a user. This could be done to display the program's results or to ask for more details so that the programme can run. Output is what the user typically sees as text on their screen.

To learn more about input and output
https://brainly.com/question/27646651
#SPJ1

The length of similar components produced by a Company are approximated by a normal distribution model with a mean of 5 cm and a standard deviation of 0.02 cm. If a component is chosen at random,

What is the probability that the length of this component is between 4.98 and 5.02 cm?
What is the probability that the length of this component is between 4.96 and 5.04 cm?

Answers

The probability that the length of this component is between 4.98 and 5.02 cm is 0.6826. The probability that the length of this component is between 4.96 and 5.04 cm is 0.9544.

What is probability?

The area of mathematics dealing with probability is known as probability theory. Despite the fact that there are numerous ways to understand probability, probability theory treats the idea in a formal mathematical way by expressing thru a set of axioms. These axioms typically formalize probability as a sample space, that assigns a measure having value of 0 or 1 to a specific outcome called as the sample space. The term "event" refers to any about its of the sample space.

To know more about probability
https://brainly.com/question/11234923
#SPJ1

what is database? Enlist there types.

Answers

its like the thing that holds your contacts info in your phone or your social media account

databases hold other information too

big companies like banks usually have huge databases

they're usually in a excel spreadsheet sheet like format

in that format things like name, phone number, email, bank account, interest rate are COLUMNS

things like bank account & interest rate amounts are usually ROWS

when you look for a hard to find social media accounts thru various search websites thats like DATA MINING

Write a converter program for temperatures. This program should prompt the user for a temperature in Celsius. It should then convert the temperature to Fahrenheit and display it to the screen. Finally, it should convert the Fahrenheit temperature to Kelvin and display that to the screen.

Answers

Answer:

c = float(input("Enter the temperature in Celsius: "))

f = c * 1.8 + 32

print("The temperature in Fahrenheit: " + str(f))

k = (f - 32) / 1.8 + 273.15

print("The temperature in Kelvin: " + str(k))

Explanation:

*The code is in Python.

Ask the user to enter the temperature in Celsius

Convert the Celsius to Fahrenheit using the conversion formula and print it

Convert the Fahrenheit to Kelvin using the conversion formula and print it

Write a program HousingCost.java to calculate the amount of money a person would pay in renting an apartment over a period of time. Assume the current rent cost is $2,000 a month, it would increase 4% per year. There is also utility fee between $600 and $1500 per year. For the purpose of the calculation, the utility will be a random number between $600 and $1500.
1. Print out projected the yearly cost for the next 5 years and the grand total cost over the 5 years.
2. Determine the number of years in the future where the total cost per year is over $40,000 (Use the appropriate loop structure to solve this. Do not use break.)

Answers

Answer:

import java.util.Random;

public class HousingCost {

public static void main(String[] args) {

int currentRent = 2000;

double rentIncreaseRate = 1.04;

int utilityFeeLowerBound = 600;

int utilityFeeUpperBound = 1500;

int years = 5;

int totalCost = 0;

System.out.println("Year\tRent\tUtility\tTotal");

for (int year = 1; year <= years; year++) {

int utilityFee = getRandomUtilityFee(utilityFeeLowerBound, utilityFeeUpperBound);

int rent = (int) (currentRent * Math.pow(rentIncreaseRate, year - 1));

int yearlyCost = rent * 12 + utilityFee;

totalCost += yearlyCost;

System.out.println(year + "\t$" + rent + "\t$" + utilityFee + "\t$" + yearlyCost);

}

System.out.println("\nTotal cost over " + years + " years: $" + totalCost);

int futureYears = 0;

int totalCostPerYear;

do {

futureYears++;

totalCostPerYear = (int) (currentRent * 12 * Math.pow(rentIncreaseRate, futureYears - 1)) + getRandomUtilityFee(utilityFeeLowerBound, utilityFeeUpperBound);

} while (totalCostPerYear <= 40000);

System.out.println("Number of years in the future where the total cost per year is over $40,000: " + futureYears);

}

private static int getRandomUtilityFee(int lowerBound, int upperBound) {

Random random = new Random();

return random.nextInt(upperBound - lowerBound + 1) + lowerBound;

}

}

Please help its due on May 7th and the code has to be in python.

Please help its due on May 7th and the code has to be in python.
Please help its due on May 7th and the code has to be in python.
Please help its due on May 7th and the code has to be in python.
Please help its due on May 7th and the code has to be in python.
Please help its due on May 7th and the code has to be in python.

Answers

We can use a list to store the sensor objects, and we can sort the list by room number, room description, or sensor number. However, accessing a sensor by its room number would require iterating through the entire list.

How to explain the information

A tuple is similar to a list, but it is immutable, meaning that it cannot be modified once created. We could use a tuple to store each sensor object, but sorting the tuple would require creating a new sorted tuple. Accessing a sensor by its room number would also require iterating through the entire tuple.

A set is an unordered collection of unique items, and it can be modified. We could use a set to store the sensor objects, but sorting the set is not possible. Accessing a sensor by its room number would also require iterating through the entire set.

Learn more about sensor on

https://brainly.com/question/29569820

#SPJ1

if we add 100 + 111 using a full adder, what is your output?

Answers

A digital circuit that performs addition is called a full adder. Hardware implements full adders using logic gates. Three one-bit binary values, two operands, and a carry bit are added using a complete adder. Two numbers are output by the adder: a sum and a carry bit. 100 has the binary value, 1100100.  Is your output.

What full adder calculate output?

When you add 1 and 1, something similar occurs; the outcome is always 2, but because 2 is expressed as 10 in binary, we receive a digit 0 and a carry of 1 as a result of adding 1 + 1 in binary.

Therefore, 100 has the binary value, 1100100. As we all know, we must divide any number from the decimal system by two and record the residual in order to convert it to binary.

Learn more about full adder here:

https://brainly.com/question/15865393

#SPJ1

can anyone teach me the basics of lua scripts 50 points
like how do i tell lua to move a object or send me a prompt asking me to do something

Answers

Answer:

are you talking about about a game, or coding?

Corrine is writing a program to design t-shirts. Which of the following correctly sets an attribute for fabric? (3 points)

self+fabric = fabric
self(fabric):
self = fabric()
self.fabric = fabric

Answers

The correct option to set an attribute for fabric in the program would be: self.fabric = fabric

What is the program

In programming, defining an attribute involves assigning a value to a particular feature or property of an object. Corrine is developing a t-shirt design application and intends to assign a characteristic to the t-shirt material.

The term "self" pertains to the specific object (i. e the t-shirt) which Corrine is currently handling, as indicated in the given statement. The data stored in the variable "fabric" represents the type of material used for the t-shirt.

Learn more about program  from

https://brainly.com/question/26134656

#SPJ1

Which of the following statements is TRUE of a peer-to-peer network?
A. Different parties have very different opinions on what can and can’t be shared through a peer-to-peer network.
B. In a peer-to-peer network, all files being shared are kept on one server. Anyone who wants to access one of those files can get it directly from the server.
C. A peer-to-peer network can create heavy traffic and makes download times increase significantly.
D. Creating a directory of which computers have certain files is an acceptable practice.

Answers

Answer:

A. Different parties have very different opinions on what can and can’t be shared through a peer-to-peer network.

Explanation:
CORRECT
Choice 'A' is very true.
There have been many arguments and court cases over what content can and cannot be shared through a peer-to-peer network. Users of these networks often argue that free speech allows us to share whatever we want online. Content creators on the other hand frequently sue for copyright infringement.


INCORRECT
Choice 'B' is describing a centralized system, not a peer-to-peer network. In a peer-to-peer network, there is no central location of files. Files are transferred directly from one computer to another without a middleman.

Choice 'C' is also not true of peer-to-peer networks. These networks are actually much more efficient than centralized systems because there is no large server holding all the files. It takes less time to download files from a peer-to-peer network because there is no centralized source of information and files.

Choice 'D' is also false; this was decided in the court case about Napster, one of the first large peer-to-peer networks. Having a centralized directory of who has which files is not considered free speech.

The peer-to-peer network is said to have varying views that form the basis of what can and cannot be shared. Thus, option A is correct.

What is a peer-to-peer network?

A peer-to-peer network is given as the connection of the computers that are linked with the following same responsibilities and permissions.

The network is said to have varying views. Many debates and court cases have erupted over what content can and cannot be shared over a peer-to-peer network.

Users of these sites frequently argue that freedom of speech allows us to share whatever we want on the internet.On the other hand, content creators frequently file copyright infringement lawsuits.

Thus, option A is correct.

Learn more about peer-to-peer networks, here:

https://brainly.com/question/1172049

#SPJ2

if-else AND if-elif-else
need at minimum two sets of if, one must contain elif
comparison operators
>, <, >=, <=, !=, ==
used at least three times
logical operator
and, or, not
used at least once
while loop AND for loop
both a while loop and a for loop must be used
while loop
based on user input
be sure to include / update your loop control variable
must include a count variable that counts how many times the while loop runs
for loop must include one version of the range function
range(x), range(x,y), or range(x,y,z)
comments
# this line describes the following code
comments are essential, make sure they are useful and informative (I do read them)
at least 40 lines of code
this includes appropriate whitespace and comments
python

Answers

Based on the image, one can see an example of Python code that is said to be able to meets the requirements that are given in the question:

What is the python?

The code given is seen as a form of  a Python script that tells more on the use of if-else as well as if-elif-else statements, also the use of comparison operators, logical operators, and others

Therefore, one need to know that the code is just a form of an example and it can or cannot not have a special functional purpose. It is one that is meant to tell more on the use of if-else, if-elif-else statements, etc.

Learn more about python from

https://brainly.com/question/26497128

#SPJ1

if-else AND if-elif-elseneed at minimum two sets of if, one must contain elifcomparison operators&gt;,
if-else AND if-elif-elseneed at minimum two sets of if, one must contain elifcomparison operators&gt;,

a democratic government has to respect some rules after winning the elections. Which of these points is not a part of those rules

Answers

After coming to power, a democratic administration is bound to follow certainrules and regulations. And Office-bearers are not accountable is not a part of those   rules.

How is this so?

In a democratic administration,office-bearers are indeed accountable as they are bound by rules and regulations.

The accountability ensures transparency,ethical conduct, and adherence to the principles of democracy.

Office-bearers are expected to uphold the laws and serve the interests of the people they represent.

Learn more about  democratic administration at:

https://brainly.com/question/31766921

#SPJ1

In which sections of your organizer should the outline be located?

Answers

The outline of a research proposal should be located in the Introduction section of your organizer.

Why should it be located here ?

The outline of a research proposal should be located in the Introduction section of your organizer. The outline should provide a brief overview of the research problem, the research questions, the approach, the timeline, the budget, and the expected outcomes. The outline should be clear and concise, and it should be easy for the reader to follow.

The outline should be updated as the research proposal evolves. As you conduct more research, you may need to add or remove sections from the outline. You may also need to revise the outline to reflect changes in the project's scope, timeline, or budget.

Find out more on outline at https://brainly.com/question/4194581

#SPJ1

There is an inertial measurement unit (IMU) measurement sensor that needs to update 98 bytes data (with extra 2 label bytes) every 10 ms (100Hz), what is the minimum requirement of the baud rate

Answers

Answer:

"115200 and 460800" is the correct approach.

Explanation:

Total Bytes = 98 Data Bytes + 2 extra label bytes for every 10ms

                   = 100 bytes (every 10m)

Rate of data for every second will be:

= \(\frac{100\times 8}{10\times 10^{-3}}\)

= \(\frac{800}{0.01}\)

= \(80000\)

The minimum baud rate required seems to be 80000.  It is appropriate to be anything higher than 80000.  

Consequently, the 115200 as well as 460800 baud rates seems to be appropriate.

Consider the efficiency of locating the kth element in a singly-linked list. How does that compare to locating the kth element in a doubly-linked list

Answers

Answer:

Finding kth element is more efficient in a doubly-linked list when compared to a singly-linked list

Explanation:

Assuming that  both lists have firs_t and last_ pointers.

For a singly-linked list ; when locating a kth element, you have iterate through a number of k-1 elements which means that locating an element will be done only in one ( 1 ) direction

For a Doubly-linked list : To locate the Kth element can be done from two ( directions ) i.e. if the Kth element can found either by traversing the number of elements before it or after it . This makes finding the Kth element faster because the shortest route can be taken.

Finding kth element is more efficient in a doubly-linked list when compared to a singly-linked list

Chose the term that matches each definition.

: predicts technology power and capacity will double every two years


: a device invented by Douglas Engekbart to work with graphical operating systems

Answers

Answer:

Moore's Law: predicts technology power and capacity will double every two years

Computer mouse: a device invented by Douglas Engekbart to work with graphical operating systems

Explanation:

What additional uses of technology can u see in the workplace

Answers

Answer:

Here are some additional uses of technology in the workplace:

Virtual reality (VR) and augmented reality (AR) can be used for training, simulation, and collaboration. For example, VR can be used to train employees on how to operate machinery or to simulate a customer service interaction. AR can be used to provide employees with real-time information or to collaborate with colleagues on a project.Artificial intelligence (AI) can be used for a variety of tasks, such as customer service, data analysis, and fraud detection. For example, AI can be used to answer customer questions, identify trends in data, or detect fraudulent activity.Machine learning can be used to improve the accuracy of predictions and decisions. For example, machine learning can be used to predict customer churn, optimize marketing campaigns, or improve product recommendations.Blockchain can be used to create secure and transparent records of transactions. For example, blockchain can be used to track the provenance of goods, to manage supply chains, or to record financial transactions.The Internet of Things (IoT) can be used to connect devices and collect data. For example, IoT can be used to monitor equipment, track assets, or collect data about customer behavior.

These are just a few of the many ways that technology can be used in the workplace. As technology continues to evolve, we can expect to see even more innovative and creative uses of technology in the workplace.

Changing the color of the text in your document is an example of

Answers

Answer:

???????????uhhh text change..?

Explanation:

Answer:

being creative

Explanation:

cause y not?

. Write a program to calculate the square of 20 by using a loop
that adds 20 to the accumulator 20 times.

Answers

The program to calculate the square of 20 by using a loop

that adds 20 to the accumulator 20 times is given:

The Program

accumulator = 0

for _ in range(20):

   accumulator += 20

square_of_20 = accumulator

print(square_of_20)

Algorithm:

Initialize an accumulator variable to 0.

Start a loop that iterates 20 times.

Inside the loop, add 20 to the accumulator.

After the loop, the accumulator will hold the square of 20.

Output the value of the accumulator (square of 20).

Read more about algorithm here:

https://brainly.com/question/29674035

#SPJ1

true or false. Two of the main differences between storage and memory is that storage is usually very expensive, but very fast to access.​

Answers

Answer:

False. in fact, the two main differences would have to be that memory is violate, meaning that data is lost when the power is turned off and also memory is faster to access than storage.

You are testing the user experience.

Which of these are issues that affect the user experience?

Select 2 options.


You did not use comments to document your code.

A user complained about the language used in the program.

The variables do not have meaningful names.

The program should have used a loop for a repetitive process.

The numerical results are not calculated correctly.

Answers

Answer:

You can answer this very easily by considering which of the circumstances affect the end user and which affect the developer:

1) Didn't use comments in the code

- affects developers

2) User complaints about language used in the program

- affects users

3) The variables have meaningless names

- affects developers

4) The program should have used a loop

- affects developers

5) The numeric results are incorrect

- affects users

Your answers then are 2 and 5, spoken languages and incorrect output will very much affect the user experience.

The issues that affect the user experience user complained about the language used in the program. The numerical results are not calculated correctly. The correct option is B and E.

What is user experience?

The term "user experience" describes how a product, application, system, or service makes the user feel.

It is a general term that can refer to anything, including how easily a user can navigate a product, how simple it is to use, how pertinent the shown content is, etc.

Information architecture, interaction design, and graphic design are the three primary subfields of UX design.

The focus of interaction design is on how customers engage with a given good or service. This covers the creation of user interfaces, including buttons and menus.

The problems affecting user experience The program's wording was criticized by a user. The numerical outcomes are incorrectly calculated.

Thus, the correct option is B and E.

For more details regarding user experience, visit:

https://brainly.com/question/29352526

#SPJ2

Among the following, which is the best protection against ransomware?
Windows File History
Carbonite
Keylogger software
Authy by Twilio

Answers

Answer:

A

Explanation:

windows file history

Language: Java
Your task is to complete the logic to manage a twenty-four-hour clock (no dates, just time) that tracks
the hours, minutes, and sections, and various operations to adjust the time. The framework for your
clock is in the Time class with the four methods you must complete.
1.) advanceOneSecondâ A user calls this method to advance the clock by one second.
a. When the seconds value reaches 60, it rolls over to zero.
b. When the seconds roll over to zero, the minutes advance.
So 00:00:59 rolls over to 00:01:00.
c. When the minutes reach 60, they roll over and the hours advance.
So 00:59:59 rolls over to 01:00:00.
d. When the hours reach 24, they roll over to zero.
So 23:59:59 rolls over to 00:00:00.
2.) compareTo â The user wants to know if a second time is greater than or less than the time
object called, assuming both are on the same date.
a. Returns -1 if this Time is before otherTime.
b. Returns 0 if this Time is the same as otherTime.
c. Returns 1 if this Time is after otherTime.
3.) add â Adds the hours, minutes, and seconds of another time (the offset) to the current time
object. The time should ârolloverâ if it exceeds the end of a 24 hour period.
4.) subtract â Subtracts the hours, minutes, and seconds of another time (the offset) from
the current time object. The time should âroll backâ if it precedes the beginning of a 24 hour
period.
________________________________________________________________________
package clock;
/**
* Objects of the Time class hold a time value for a
* European-style 24 hour clock.
* The value consists of hours, minutes and seconds.
* The range of the value is 00:00:00 (midnight) to 23:59:59 (one
* second before midnight).
*/
public class Time {
private int hours;
private int minutes;
private int seconds;
/**
* Add one second to the current time.
* When the seconds value reaches 60, it rolls over to zero.
* When the seconds roll over to zero, the minutes advance.
* So 00:00:59 rolls over to 00:01:00.
* When the minutes reach 60, they roll over and the hours advance.
* So 00:59:59 rolls over to 01:00:00.
* When the hours reach 24, they roll over to zero.
* So 23:59:59 rolls over to 00:00:00.
*/
public void advanceOneSecond()
{
}
/**
* Compare this time to otherTime.
* Assumes that both times are in the same day.
* Returns -1 if this Time is before otherTime.
* Returns 0 if this Time is the same as otherTime.
* Returns 1 if this Time is after otherTime.
*/
public int compareTo(Time otherTime)
{
return 0;
}
/**
* Add an offset to this Time.
* Rolls over the hours, minutes and seconds fields when needed.
*/
public void add(Time offset)
{
}
/**
* Subtract an offset from this Time.
* Rolls over (under?) the hours, minutes and seconds fields when needed.
*/
public void subtract(Time offset)
{
}

Answers

Using the knowledge in computational language in JAVA  it is possible to write a code that user calls this method to advance the clock by one second. When the seconds value reaches 60, it rolls over to zero.

Writting the code:

public class Time

{

   private int hours;

   private int minutes;

   private int seconds;

   

   public void advanceOneSecond()

   {

      seconds++;

      if(seconds >= 60)

      {

             seconds -= 60;

             minutes++;

      }

      if(minutes >= 60)

      {

             minutes -= 60;

             hours++;

      }

      if(hours >= 24)

             hours -= 24;

   }

   

   public int compareTo(Time otherTime)

   {

      if(hours > otherTime.hours)

             return 1;

     

      else if(hours < otherTime.hours)  

             return -1;

      else

      {

             if(minutes > otherTime.minutes)

                    return 1;

             else if(minutes < otherTime.minutes)

                    return -1;

             else

             {

                    if(seconds > otherTime.seconds)

                           return 1;

                    else if(seconds < otherTime.seconds)

                           return -1;

                    else

                           return 0;

             }

      }

   }

   

   public void add(Time offset)

   {

      seconds += offset.seconds;

      minutes += offset.minutes;

      hours += offset.hours;

      if(seconds >= 60)

      {

             seconds -= 60;

             minutes++;

      }

      if(minutes >= 60)

      {

             minutes -= 60;

             hours++;

      }

      if(hours >= 24)

             hours -= 24;

   }

   

   public void subtract(Time offset)

   {

      if(offset.seconds > seconds)

      {

             minutes--;

             seconds = seconds + 60;

      }

      seconds -= offset.seconds;

      if(offset.minutes > minutes)

      {

             hours--;

             minutes = minutes + 60;

      }

      minutes -= offset.minutes;

      if(offset.hours > hours)

      {

             hours += 24;

      }

      hours -= offset.hours;

   }

}

See more about JAVA at brainly.com/question/18502436

#SPJ1

Language: JavaYour task is to complete the logic to manage a twenty-four-hour clock (no dates, just time)
Other Questions
Huntington's Disease is autosomal dominant. Karl's has HD. Karl's father has HD but his mother is disease free. Samantha has no history of HD in her family, both parents are disease free. Samantha and Karl are expecting their first child. What is the probability their child will have HD. 100% 50% none of these are correct. 6.25% 0% myrra is young college graduate. she is considering dentistry as her post-graduate work. if myrra is pursuing this option at ucla in 1972, how many women is myrra likely to meet in her class of 100? PLEASE HELP IM GOING T0O FAIL THIS :(A charity needs to report its typical donations received. The following is a list of the donations from one week. A histogram is provided to display the data.5, 5, 6, 8, 10, 15, 18, 20, 20, 20, 20, 20, 20A graph titled Donations to Charity in Dollars. The x-axis is labeled 1 to 5, 6 to 10, 11 to 15, and 16 to 20. The y-axis is labeled Frequency. There is a shaded bar up to 2 above 1 to 5, up to 3 above 6 to 10, up to 1 above 11 to 15, and up to 7 above 16 to 20.Which measure of variability should the charity use to accurately represent the data? Explain your answer.The range of 13 is the most accurate to use, since the data is skewed.The IQR of 13 is the most accurate to use, since the data is skewed.The range of 20 is the most accurate to use to show that they have plenty of money.The IQR of 20 is the most accurate to use to show that they need more money. Find the proper answer what is 100200 need help Summarize the ideas in the second article about why Florida had to recount its votes and what the immediate result of this recount was. Which table shows a linear function? In a local bagel shop, the number of plain bagels soldin one month increased as the number of onion bagelsincreased. Is this an example of a positive correlation,negative correlation, or no correlation? Which of the following is a rational number?A. [tex]\sqrt{10}[/tex]B.[tex]\sqrt{100}[/tex]C.[tex]\sqrt{1000}[/tex]D.[tex]\sqrt{100000}[/tex]Can you please explain your answer I want to understand it For experienced growers only. Yes this is a controversial question and could trigger different opinions and topics but, I'm currently 5'5 age 15 male. My dad is 5'4-5'5, and my mother is 5'2, how tall will I be when I reach 18. Please don't use a height calculator I would just like an analysis. Every morning I wake up early usually get about 7-8 hrs of sleep, and I usually do calisthenics/weightlifting at my room, and then jog for about 30 minutes, and eat breakfast which is my main meal which most of the time considers, beef/chicken and broccoli with a small carton of milk, and 1 hard boiled egg everyday. And for afternoon, and night I eat whatever my parents cooked me. So yeah feel free to be brutally honest to me. Cuz I rather have the harsh truth then the feigning of ignorance. (8gh)^2 Simplify the expression. as part of a pronunciation task, you are presented with a list of made-up names. later, during a second, unrelated task, some of the names appear again and you are asked if they are the names of famous people. which factor will influence the likelihood that you will think the name belongs to a famous person? 6. Simplify: i) (a + b)(5a 3b) + (a 3b)(a b) ii) (a b) (a2 + b2 + ab) (a + b) (a2 + b2 ab) iii) (b2 49) (b + 7) + 343 okay, I know I posted this question before but, if you're giving your answers, please explain how you got it, What volume of each of the following solutions contains 0.150mol of the solute?a) 0.0025M HClb) 1.25M ZnSO4 if y=156 when x=39 what is y when x is 17 please show work Kant's sister has 150 red marbles and 360 pink marbles and she wants the same number of marbles on each row, what is the least number of rows she can make ? Jace estimated the product of (34.57)(0.74) by rounding each number to the nearest tenth. What was Jaces estimate?25.624.2224.2225.6 The results of a survey show that the percent of adults in a certain town who want to change the name of the town is in the interval [0.78 ,0.86]What is the point estimate for the percent who want to change the towns name?What is the polls margin of error?Do you think the town is most likely to change its name? Why? Which of the following best defines a trust?A trust is a large company or business combination that controls a market.A trust is a large company that consists of two merged businesses.A trust is a business that competes with other businesses in its market.A trust is made of multiple businesses that combine and operate in one state. which of the following traits are found in all primates select all that apply