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
andriy [413]
3 years ago
14

2.3 Code Practice: Question 3

Computers and Technology
1 answer:
Tpy6a [65]3 years ago
8 0

Answer:

Code in C++

Explanation:

C++ Code

#include<iostream> //for input and output  

using namespace std;  

int main()  

{  

  int hour;

  int minute;

  cout<<"Enter the hour:";

  cin>> hour;

  cout<<"Enter the minute:";

  cin>>minute;

  minute = minute+15;

  if(minute>=60){

   hour++;

   minute=minute-60;

  }

  if(hour>=24){

   hour=0;

  }

  cout<<"Hours: "<<hour<<endl;

  cout<<"Minutes:"<<minute;

  return 0;  

}

Code Explanation

First we need to declare two int variables to hold hour and minute values input from user.

Check if by adding 15 minutes into minute entered by user is greater then or equal to 60 then increment into hour and subtract 60 from minute.

Another check is that if user enters more then 24 hour or by making increment into hour, the hour values i greater then or equal to 24 then we need to change the hour to 0.

Result

Case 1:

Enter the hour:8

Enter the minute:15

Hours: 8

Minutes:30

Case 2:

Enter the hour:9

Enter the minute:46

Hours: 10

Minutes:1

You might be interested in
The language a person speaks is one example of ________________.
adoni [48]

Answer: b. Códigos de comunicación/ comunication codes

Explanation:

5 0
3 years ago
Read 2 more answers
The general syntax to overload the stream extraction operator &gt;&gt; for a class is ____.
Aloiza [94]
Istream& operator>> (istream& input, Example& example)
{
// Extract your data from input stream here
return input;
}
5 0
4 years ago
two Smallest (10 points). Write a program TwoSmallest.java that takes a set of double command-line arguments and prints the smal
Umnica [9.8K]

Answer:

Below is the program TwoSmallest.java with each step explanation in form of comments.

public class TwoSmallest {                     // class definition

//main class having string args as a parameter

   public static void main(String[] args)

{ if (args.length < 2)

{         //string length must not be less than 2 for proceeding

           System.out.println("Please provide double values as command line arguments");

  }

else {  

// first two entries of string are checked for min1 and min2 and stored in variables with data type double

           double min1 = Double.parseDouble(args[0]), min2 = Double.parseDouble(args[1]), num;

//when min1 will be greater than min2 it will be stored temporary in variable temp having data type double

           if (min1 > min2) {

               double temp = min1;

               min1 = min2;

               min2 = temp;  //value of temp will be stored in min2

           }

//loop will check for each entry remaining until the last character of string

           for (int i = 2; i < args.length; i++) {

               num = Double.parseDouble(args[i]);

               if (num < min1) {

                   min2 = min1;

                   min1 = num;

               } else if (num < min2) {

                   min2 = num;

               }

           }

//min1 will give the 1st minimum number and min2 will give 2nd minimum.

           System.out.println(min1);

           System.out.println(min2);  

//both characters will be printed in sequence

       }

   }

}

4 0
4 years ago
The _____ address range is reserved for a computer to communicate with itself and is called the loopback.
Papessa [141]
The answer is 127 I had that question before
4 0
4 years ago
Ask what kind of pet the user has. If they enter cat, print "Too bad...", if they enter dog, print "Lucky you!" (You can change
nirvana33 [79]

Answer:

Explanation:

a = input("what kind of pet the user has")

if a == 'cat':

  print("Too bad")

elif a == 'dog':

   print("Lucky you!")

8 0
3 years ago
Other questions:
  • Alexei was given a key to a substitution cipher. The key showed that the entire alphabet was rotated 13 steps. What type of ciph
    7·1 answer
  • Which is the most important reason you should properly cite information that you obtain from an Internet search? Question 2 opti
    8·1 answer
  • What is the automotive name for the large wires that allow more electrical current to flow ?
    12·1 answer
  • Whatis NOT a key factor while designing a website?
    12·1 answer
  • What is required for sitting with your seatbelt on while driving?
    7·1 answer
  • _____ creates a border or space that separates information.
    14·1 answer
  • Which devices typically generate computer output? monitor, printer, speaker, projector, keyboard mouse, printer, speaker, projec
    7·1 answer
  • When performing the ipconfig command, what does the following output line depict if found in the tunnel adapter settings?
    5·1 answer
  • I don't know if this is supposed to go here or art but i need help with photoshop, basically you can create whatever you want bu
    7·1 answer
  • Your network uses a network address of 137. 65. 0. 0 with a subnet mask of 255. 255. 0. 0. How many ip addresses are available t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!