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
Shtirlitz [24]
3 years ago
13

Complete the missing code in the templatepublic class Exercise09_04Extra { public static void main(String[] args) { SimpleTime t

ime = new SimpleTime(); time.hour = 2; time.minute = 3; time.second = 4; System.out.println("Hour: " + time.hour + " Minute: " + time.minute + " Second: " + time.second); } } class SimpleTime { // Complete the code to declare the data fields hour, // minute, and second of the int type }
Computers and Technology
1 answer:
snow_lady [41]3 years ago
3 0

Answer:

The code to this question can be given as:

code:

public class Exercise09_04Extra //define class

{

public static void main(String[] args) //define main method

{

SimpleTime time = new SimpleTime(2,3,4);

//create object of the class

System.out.println("Hour: " + time.hour + " Minute: " + time.minute + " Second: " +time.second); //print result

}

}

class SimpleTime //define class

{

int hour,minute,second; //set three integer variable

SimpleTime( int hour, int minute, int second ) //define parameterized constructor

{

this.hour = hour;

this.minute = minute;

this.second = second;

}

}

Output:

Hour: 2 Minute: 3 Second: 4

Explanation:

In the above java code firstly we define a main class that is Exercise09_04Extra. In this class we create another class object that is SimpleTime . Then we call parameterized constructor and print the values. When we call the SimpleTime class in this class we define an integer variable that is hour, minute and second and create the parameterized constructor and pass the variable as a parameter.In this constructor we use this keyword to hold the value of the passing variable. So the output of the following code is "Hour: 2 Minute: 3 Second: 4 ".

You might be interested in
Importancia del sistema operativo
love history [14]

Answer:

Un sistema operativo es el software más importante de tu computador, ya que se encarga de gestionar el hardware, el acceso a la memoria, acceso a la CPU y controlar gran parte de las tareas que lleva a cabo tu computador.

7 0
3 years ago
#A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every
lara [203]

Answer:

To check if the year comes under each 100th year, lets check if the remainder when dividing with 100 is 0 or not.

Similarly check for 400th year and multiple 0f 4. The following C program describes the function.

#include<stdio.h>

#include<stdbool.h>

bool is_leap_year(int year);

void main()

{

int y;

bool b;

 

printf("Enter the year in yyyy format: e.g. 1999 \n");

scanf("%d", &y);     // taking the input year in yyyy format.

 

b= is_leap_year(y);  //calling the function and returning the output to b

if(b==true)

{

 printf("Thae given year is a leap year \n");

}

else

{

 printf("The given year is not a leap year \n");

}

}

bool is_leap_year(int year)

{

if(year%100==0)   //every 100th year

{

 if(year%400==0)   //every 400th year

 {

  return true;

 }

 else

 {

  return false;

 }

}

if(year%4==0)  //is a multiple of 4

{

 return true;

}

else

{

 return false;

}

}

Explanation:

Output is given as image

5 0
3 years ago
What dose AUP stand for??????????
kipiarov [429]

Answer:

Acceptable Use Policy

Explanation:

A: Acceptable

U:Use

P:Policy

3 0
3 years ago
Read 2 more answers
In python 3.17 LAB: Convert to dollars
krok68 [10]

To convert the inputs to dollars and cents, we make use of a combination of multiplication and addition.

The program written in Python where comments are used to explain each line is as follows:

<em />

<em>#This gets input for the number of quarters</em>

quarters = int(input("Quarters: "))

<em>#This gets input for the number of dimes</em>

dimes = int(input("Dimes: "))

<em>#This gets input for the number of nickels</em>

nickels= int(input("Nickels: "))

<em>#This gets input for the number of pennies</em>

pennies= int(input("Pennies: "))

<em>#This converts the amount to dollars and cents</em>

dollars = quarters * 0.25 + dimes * 0.10 + nickels * 0.05 + pennies * 0.01

<em>#This prints the amount to 2 decimal places</em>

print("Amount ${:.2f}".format(dollars))

Read more about Python programs at:

brainly.com/question/22841107

7 0
3 years ago
What are potential problems with using nanorobots ?
mash [69]
It can penetrate the blood-brain barrier.
5 0
3 years ago
Other questions:
  • When did Kodak introduce film photography to the commercial market?
    10·2 answers
  • Data mining is ______? a process of finding meaningful patterns in data to improve decisions a strategy for locating security so
    7·1 answer
  • Produce definition in computer
    12·2 answers
  • Select the correct answer.
    7·1 answer
  • Company XYZ has a new employee named John Anderson. His employee ID is XYZ1234. His email address will be <a href="/cdn-cgi/l/em
    10·1 answer
  • What are the methods of identifying publicly switched networks?
    14·1 answer
  • print out the last even number from an array of integers, if there is no even number, then print out a sentence indicating so.
    5·1 answer
  • 8.2 Code Practice Edhesive
    6·1 answer
  • Why might you want to save a downloaded file to your computer first instead of running it immediately?
    6·1 answer
  • Please respond not with answer but with comment.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!