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
viva [34]
4 years ago
13

Create a new program called Time.java. From now on, we won’t remind you to start with a small, working program, but you should.

2. Following the example program in Section 2.4, create variables named hour, minute, and second. Assign values that are roughly the current time. Use a 24-hour clock so that at 2pm the value of hour is 14. 3. Make the program calculate and display the number of seconds since midnight. 4. Calculate and display the number of seconds remaining in the day. 5. Calculate and display the percentage of the day that has passed. You might run into problems when computing percentages with integers, so consider using floating-point. 6. Change the values of hour, minute, and second to reflect the current time. Then write code to compute the elapsed time since you started
Computers and Technology
1 answer:
alexgriva [62]4 years ago
3 0

Answer:

Explanation:

public class time {

public static void main (String[]args) {

 //Step 1  we declare the variables

 int hours, minutes, seconds;

 hours = 17;

 minutes = 12;

 seconds = 00;

 //For checking

 System.out.println(hours+":"+minutes+":"+seconds);

 //Step 2 we make the operation for the seconds since midnight

 int secSinceMidNite;

 secSinceMidNite = ((hours*60)+minutes)*60 + seconds;

 System.out.println("Seconds since midnight = "+secSinceMidNite);

 //Step 3 we make the operation for the seconds remaining in day

 int secRemainingInDay, totalSecInDay;

 totalSecInDay = 24*60*60;

 secRemainingInDay = totalSecInDay - secSinceMidNite;

 System.out.println("Seconds remaining in day = "+secRemainingInDay);

 //Step 4 in the operation for percentage of day that has passed

 int percentOfDayPassed;  

 percentOfDayPassed = (secSinceMidNite*100)/totalSecInDay;

 System.out.println("Percentage of day that has passed = " +percentOfDayPassed+"%");

}

}

You might be interested in
5.23 LAB: Contains the character
torisob [31]

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main() {

int len;

cout<<"Length: ";  cin>>len;

string inpt;

vector<string> vect;

for(int i =0;i<len;i++){

  cin>>inpt;

  vect.push_back(inpt); }

char ch;

cout<<"Input char: ";  cin>>ch;  

for(int i =0;i<len;i++){

  size_t found = vect.at(i).find(ch);  

      if (found != string::npos){

          cout<<vect.at(i)<<" ";

          i++;

      }

}  

return 0;

}

Explanation:

This declares the length of vector as integer

int len;

This prompts the user for length

cout<<"Length: ";  cin>>len;

This declares input as string

string inpt;

This declares string vector

vector<string> vect;

The following iteration gets input into the vector

for(int i =0;i<len;i++){

  cin>>inpt;

  vect.push_back(inpt); }

This declares ch as character

char ch;

This prompts the user for character

cout<<"Input char: ";  cin>>ch;  

The following iterates through the vector

for(int i =0;i<len;i++){

This checks if vector element contains the character

  size_t found = vect.at(i).find(ch);  

If found:

      if (found != string::npos){

Print out the vector element

          cout<<vect.at(i)<<" ";

And move to the next vector element

          i++;

      }

}  

7 0
2 years ago
1. It manages the computer's memory and processes, as well as all of its software and hardware.
8_murik_8 [283]

Answer:

B. Computer operating system

Explanation:

the operating system (or OS) manages all of the hardware and software in the computer, and allows hardware and software to communicate.

We can also figure this out by process of elimination: Application software is just a fancy way to say apps, Graphical User Interface (or GUI) are menus that allow a user to use the computer through a visual representation (what you interact with using your mouse), and microcomputer just means a small computer like a laptop or a phone.

6 0
3 years ago
Assume the variable date has been set to a string value of the form mm/dd/yyyy, for example 09/08/2010. (Actual numbers would ap
bonufazy [111]

Answer:

String date = "21/05/2020";

String dayStr = date.substring(0,2);

int day = Integer.parseInt(dayStr);

System.out.println(day);

Explanation:

Create a variable called <em>date</em> which holds the current date

Create a variable called <em>dayStr</em>. Initialize it to the day part of the <em>date</em> using the substring method

Create a variable called <em>day</em>. Parse the <em>dayStr</em> and assign it to the <em>day</em>

Print the <em>day</em>

6 0
4 years ago
A report that ends with the author providing his or her plan for next steps is considered a
Angelina_Jolie [31]
The specific part of the report wherein the author would provide his suggestions on the next plans that would be carried out in the study would be the recommendations. In addition, it would open the opportunity to other aspiring researchers to expound and better improve the study.
4 0
3 years ago
Heya!!<br><br> -:QUESTION :-<br><br> DEFINE DATA SCIENCE?​
finlep [7]

\large \underline{ \frak{ ~~~~~~~~~~~~~~~~~~~~\bigstar Solution~~~~~~~~~~~~~~~~~~~~}}

Data science helps to understand and analyse the actual scenario and help to take fruitful decisions. 

4 0
3 years ago
Read 2 more answers
Other questions:
  • Waterpower was first harvested by ancient societies using
    5·1 answer
  • Write a Python program that gets a number using keyboard input. (Remember to use input for Python 3 but raw_input for Python 2.)
    8·1 answer
  • Why is it important to open the Map Custom Fields dialog box before importing/exporting a list of contacts? Check all that apply
    6·2 answers
  • A​ _______ variable is a variable that has a single numerical​ value, determined by​ chance, for each outcome of a procedure.
    7·1 answer
  • An organization’s SOC analyst, through examination of the company’s SIEM, discovers what she believes is Chinese-state sponsored
    12·1 answer
  • The marketplace is the essence of which of the following?
    11·1 answer
  • cellPhoneBill(m,tx)Write the function cellPhoneBill()that takes two int m and txas input and returns a float.The function takes
    11·1 answer
  • Agile methods typically use a ______ model, which represents a series of iterations, or revisions, which are based on user feedb
    7·1 answer
  • Jane is a full-time student on a somewhat limited budget, taking online classes, and she loves to play the latest video games. S
    14·1 answer
  • Question 1
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!