Write a method that converts a time given in seconds to hours, minutes and seconds using the following header:

public static String convertTime(int totalSeconds)

The method returns a string that represents the time as hours:minutes:seconds.

Write a test program that asks the user for the time in seconds and then display the time in the above format.

Answers

Answer 1

Answer:

hope this helps.

Explanation:

import java.util.*;

class Timeconvert{ //class nane

public static String convertTime(int totalSeconds) /* fn to convert seconds to hh:mm:ss format */

{

int sec = totalSeconds; // a copy of totalSeconds is stored in sec

int m=sec/60; //to find the total min which obtained by doing sec/60

int psec=sec%60; //psec store remaining seconds

int hrs=m/60; //stores hr value obtained by doing m/60

int min=m%60; //stores min value obtained by m%60

return (hrs + ":" + min+ ":" +psec);// returning that string

}

}

public class Main

{

  public static void main(String[] args) {

  Timeconvert t = new Timeconvert();

  Scanner in = new Scanner(System.in); //Scanner class

System.out.println("Enter the number of seconds:");

int sec = in.nextInt(); //to input number of seconds

System.out.println("hours:minutes:seconds is " + t.convertTime(sec)); //result

 

  }

}


Related Questions

14. Video game legend Shigeru Miyamoto designed all EXCEPT which of the following games?
a) Donkey Kong
b) Mario Bros
c) The Legend of Zelda
d) Pac-Man

Answers

D pac man hope im right

Taran is concerned with the security of his macros in a database. Which security option could he use to provide protection?

digital signatures
hide database objects
start-up options
secure VBA code

Answers

Answer:security VBA code

Explanation:

Annapurno
Page
Date
corite
a programe to input length and the
breath of the rectangle and cliculate the
anecan perimeter .write a program to input length and breadth of the rectangle and calculate the area and perimeter ​

Answers

Answer:

The program in Python is as follows:

Length = float(input("Length: "))

Width = float(input("Width: "))

Area = Length * Width

print("Area: ",Area)

Explanation:

This gets input for length

Length = float(input("Length: "))

This gets input for width

Width = float(input("Width: "))

This calculates the area

Area = Length * Width

This prints the calculated area

print("Area: ",Area)

Two character strings may have many common substrings. Substrings are required to be contiguous in the original string. For example, photograph and tomography have several common substrings of length one (i.e., single letters), and common substrings ph, to, and ograph as well as all the substrings of ograph. The maximum common substring length is 6. Let X = X122 . Im and Y = yıy2 - - • Yn be two character strings. Using dynamic programming, design an algorithm to find the maximum common substring length for X and Y using dynamic programming. Please follow the general steps for designing a dynamic programming solution as in Q1 (other than the actual programming part).

Answers

Answer:

Explanation:

The following function is written in Java. It takes two strings as parameters and calculates the longest substring between both of them and returns that substring length.

import java.util.*;

class Test

{

   public static void main(String[] args)

   {

       String X = "photograph";

       String Y = "tomography";

       System.out.println(X + '\n' + Y);

       System.out.println("Longest common substring length: " + longestSub(X, Y));

   }

   static int longestSub(String X, String Y)

   {

       char[] word1 = X.toCharArray();

       char[] word2 = Y.toCharArray();

       

       int length1 = X.length();

       int length2 = Y.length();

       int substringArray[][] = new int[length1 + 1][length2 + 1];

       int longestSubstringLength = 0;

       

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

       {

           for (int j = 0; j <= length2; j++)

           {

               if (i == 0 || j == 0)

                   substringArray[i][j] = 0;

               else if (word1[i - 1] == word2[j - 1])

               {

                   substringArray[i][j]

                           = substringArray[i - 1][j - 1] + 1;

                   longestSubstringLength = Integer.max(longestSubstringLength,

                           substringArray[i][j]);

               }

               else

                   substringArray[i][j] = 0;

           }

       }

       return longestSubstringLength;

   }

}

Outlines help you visualize the slides and the points you will include on each slide.
False
True

Answers

I don’t know I think true

Answer:

True

Explanation:

because it was correct

What does getfenv() do?

Answers

Answer: getfenv() is a type of function. Particually a envirotment function. for a lua coding.

Explanation: What this does it goes thourgh  line of code in a particular order.

This means. getfenv is used to get the current environment of a function. It returns a table of all the things that function has access to. You can also set the environment of a function to another environment.

Forgot to include examples of where this could be used. Although not very common uses, there are some. In the past Script Builders used getfenv to get the environment of a script, and setfenv to set the environment of a created script’s environment to a fake environment, so they couldn’t affect the real one. They could also inject custom global functions.

Not entirely sure if this uses getfenv or setfenv, but the use in Crazyman32’s AeroGameFramework is making the environment of each module have access to other modules without having to require them, and having access to remotes without having to directly reference them.

Answer: ummm, who knows

Explanation:

Which tab can be used to change the theme and background style of a presentation?
O Design
O Home
O Insert
O View

Answers

Answer:

Design

Explanation:

seems the most correct one..

I would say design as well.

I need help
I am thinking about coming out to my mom because we are going to the store today and I will be in the car, I dont know if I should or not

Answers

Answer:

do it! you will have to one day so why not now? hopefully she will understand and say nice things as well and be like mom ive

been thinking a lot and i really want to tell you something. Explanation:

Answer:most likely she is your parent that you live with so she might already know but has not said anything it also depends her personality but if your ready and know or think she would not hate you forever go for it

Explanation:

Mohammed needs to ensure that users can execute a query against a table but provide different values to the query each time it is run. Which option will achieve this goal?

parameter queries
dynamic queries
query joins
static queries

Answers

Answer:

the answer is B

Explanation:

The following table describes the required fields for two classes and typical values stored in those fields.

You are required to create a base class Printer and its child class PrinterCumScanner. Each of these classes should have user defined constructor and overridden Display() method so that the following test driver can work properly.

Answers

Answer:

hope this helps,if it did pls mark my ans as brainliest

Explanation:

using System;

class Printer{ string companyName; int pagesOutput;

double price;

public Printer(string companyName,int pagesOutput,double price){

this.companyName=companyName; this.pagesOutput=pagesOutput; this.price=price;

}

public virtual void Display(){ Console.WriteLine("companyName: "+companyName+" pagesOutput: "+pagesOutput+" price: "+price);

}

}

class PrinterCumScanner:Printer{ int imageDpi;

public PrinterCumScanner(string companyName,int pagesOutput,double price,int imageDpi):base(companyName,pagesOutput,price){ this.imageDpi=imageDpi; }

public override void Display(){ base.Display(); Console.WriteLine("imageDpi: "+imageDpi);

}

}

public class Program { static void Main(string[] args) { const int NUM_PRINTERS=3;

Printer []stock=new Printer[NUM_PRINTERS];

stock[0]=new Printer("HP",40,89.50);

stock[1]=new PrinterCumScanner("HP",40,215.0,320); stock[2]=new PrinterCumScanner("Cannon",30,175.0,240);

foreach(Printer aPrinter in stock){ aPrinter.Display();

}

}

}

Identify the following terms being described. Write your answers on the space provided.

1. Worldwide Web
______________________
2.E-mail
________________________
3.Powerline networking
_______________________
5.Cable
_______________________

Answers

Answer:

Find answers below.

Explanation:

1. Worldwide Web: In computing, WWW simply means World Wide Web. The world wide web was invented by Sir Tim Berners-Lee in 1990 while working with the European Council for Nuclear Research (CERN); Web 2.0 evolved in 1999. Basically, WWW refers to a collection of web pages that are located on a huge network of interconnected computers (the Internet). Also, users from all over the world can access the world wide web by using an internet connection and a web browser such as Chrome, Firefox, Safari, Opera, etc.

In a nutshell, the World Wide Web is an information system that is generally made up of users and resources (documents) that are connected via hypertext links.

2.E-mail: An e-mail is an acronym for electronic mail and it is a software application or program designed to let users send and receive texts and multimedia messages over the internet.

It is considered to be one of the most widely used communication channel or medium is an e-mail (electronic mail).

3. Powerline networking: this is a wired networking technology that typically involves the use of existing electrical cables in a building to connect and transmit data on network devices through powerline network adapters.

4. Cable: this include network cables such as CAT-5, CAT-6 and fiber optic cables used for connecting and transmitting signals between two or more network devices.

Write an algorithm (pseudo-code) that takes an unsorted list of n integers and outputs a sorted list of all duplicate integers. There must be no duplicates in the output list, also the output list should be a sorted list. The algorithm must run in O(n) time. Show your analysis of the running time. Note: Assume that inputs are integer values from 0 to 255. (Hint: use the concept that being used in the separate chaining)

Answers

Answer:

brainliest if it did help you

Explanation:

Given array : A[0...n-1]Now, create a count array Cnt[0...n-1]then, initialize Cnt to zero

for(i=0...n-1)

Cnt[i]=0 ---------O(n) time

Linearly traverse the list and increment the count of respected number in count array.

for(i=0...n-1)

Cnt[A[i]]++; ---------O(n) time

Check in the count array if duplicates exist.

for(i=0...n-1){

if(C[i]>1)

output (i); -----------O(n) time

}

analysis of the above algorithm:

Algorithm takes = O(1 + n + n + n)

                           = O(n)          

//java code

public class SortIntegers {

  public static void sort(int[] arr) {

    int min = arr[0];

    int max = arr[0];

    for (int i = 0; i < arr.length; ++i) {

      if (arr[i] > max) {

        max = arr[i];

      }

      if (arr[i] < min) {

        min = arr[i];

      }

    }

    int counts[] = new int[max - min + 1];

    for (int i = 0; i < arr.length; ++i) {

      counts[arr[i] - min]++;

    }

    for (int i = 0; i < counts.length; ++i) {

      if (counts[i] > 1) {

        System.out.print((i + min) + " ");

      }

    }

    

    System.out.println();

  }

  public static void main(String[] args) {

    sort(new int[] { 5, 4, 10, 2, 4, 10, 5, 3, 1 });

  }

}

Sergio needs to tell his team about some negative feedback from a client. The team has been
working hard on this project, so the feedback may upset them. Which of the following explains
the best way for Sergio to communicate this information?

A) Hold an in person meeting so that he can gauge the team's body language to assess their
reaction

B) Send a memorandum so everyone will have the feedback in writing

C) Hold a video conference so everyone can see and hear about the client's concern without the group witnessing each other's reactions

D) Send an email so everyone will have time to think about the feedback before the next team meeting

Answers

Answer:

A

Explanation:

I feel that if everyone is with eachother, there may be a better hope to improve the next time

(main.c File)
Counting the character occurrences in a file
For this task you are asked to write a program that will open a file called “story.txt”
and count the number of occurrences of each letter from the alphabet in this file.
At the end your program will output the following report:
Number of occurrences for the alphabets:
a was used – times.
b was used – times.
c was used – times…. …and so, on
Assume the file contains only lower-case letters and for simplicity just a single
paragraph. Your program should keep a counter associated with each letter of the
alphabet (26 counters) [Hint: Use array]
Your program should also print a histogram of characters count by adding
a new function print Histogram (int counters []). This function receives the
counters from the previous task and instead of printing the number of times each
character was used, prints a histogram of the counters. An example histogram for
three letters is shown below) [Hint: Use the extended asci character 254]

Answers

Answer:

C code

Explanation:

#include <stdio.h>

void histrogram(int counters[])

{

   int i,j;

   int count;

   for(i=0;i<26;i++)

   {

       count=counters[i];

       printf("%c ",i+97);

       for(j=0;j<count;j++)

       {

           printf("="); //= is used

       }

       printf("\n");

      

   }

      

}

int main()

{

   FILE* fp;

   int i;

   int arr[26];

   char c;

   int val;

   // Open the file

fp = fopen("story.txt", "r");

  

if (fp == NULL) {

printf("Could not open file ");

return 0;

}

else

{

   for(i=0;i<26;i++)

   arr[i]=0;

  

   for (c = getc(fp); c != EOF; c = getc(fp))

   {

       if(c>='a' && c<='z')

       {

           val = c-97;

           //printf("%d ",val);

           arr[val]++;

          

           }

       }

       histrogram(arr);

      

  

      

  

   }

}

The variable strFirst's scope is _____.

Answers

pretty sure it’s d, hope this helps

Answer:

- the usernameMaker function

Explanation:

When you look at the code, you can see it's located alongside the usernameMaker. It it only utilized then, therefore being it's scope. For reassurance, it's also correct on Edge.

I hope this helped!

Good luck <3

The Basic premise of____is that objects can be tagged, tracked, and monitored through a local network, or across the Internet.
The basic premise of
a. artificial intelligence
b. intelligent workspaces
c. the Internet of Things
d. the digital divide

Answers

Answer:

C.

Explanation:

Internet of things

The Basic premise of the Internet of Things is that objects can be tagged, tracked, and monitored through a local network, or across the Internet option (c) is correct.

What is IoT?

The term "Internet of things" refers to actual physical items that have sensors, computing power, software, and other innovations and can link to those other systems and gadgets via the Internet or other communication networks and share files with them.

As we know,

Using a local network or the Internet, things may be identified, tracked, and monitored is the fundamental tenet of the Internet of Things.

Thus, the Basic premise of the Internet of Things is that objects can be tagged, tracked, and monitored through a local network, or across the Internet option (c) is correct.

Learn more about the IoT here:

https://brainly.com/question/25703804

#SPJ2

A major advantage of direct mapped cache is its simplicity and ease of implementation. The main disadvantage of direct mapped cache is: a. it is more expensive than fully associative and set associative mapping. b. it has a greater access time than any other method. c. its performance is degraded if two or more blocks that map to the same location are used alternately. d. it does not allow the cache to store the tag that corresponds to the block currently residing in that cache location.

Answers

brainlest   pl     jk  mmmmmmmmmmmmm

Other Questions
1A: Consider these compounds:A. PbF2B. Ni(CN)2C. FeSD. CaSO4Complete the following statements by entering the letter(s) corresponding to the correct compound(s). (If more than one compound fits the description, include all the relevant compounds by writing your answer as a string of characters without punctuation, e.g, ABC.)Without doing any calculations it is possible to determine that magnesium hydroxide is more soluble than __________, and magnesium hydroxide is less soluble than _______.It is not possible to determine whether magnesium hydroxide is more or less soluble than_______ by simply comparing Ksp values.1B: For each of the salts on the left, match the salts on the right that can be compared directly, using Ksp values, to estimate solubilities.(If more than one salt on the right can be directly compared, include all the relevant salts by writing your answer as a string of characters without punctuation, e.g, ABC.)1. nickel(II) hydroxide A. Fe(OH)22. silver chloride B. PbSC. AlPO4D. MnSWrite the expression for K in terms of the solubility, s, for each salt, when dissolved in water.nickel(II) hydroxidesilver chlorideKsp=_______Ksp=________Note: Multiply out any number and put it first in the Ksp expression. Combine all exponents for s. help ill give brainiest What is the place value of the 9 in 67.49? Someone please help its due todayChoose the correct word for the sentence 1. House is on corner? What is the correct wordTheirThereTheyre 2. The mother instructed her children to sit. During the show and not to get up?Their ThereTheyre 3. That house Is most likely to be condemned if someone doesnt start maintaining it soon Their ThereTheyre 4. Wealthy business owners keep _ Valuable property, titles and deeds in a safe deposit boxTheir ThereTheyre 5. _ Training for a marathon by running 10 miles a day Their There Theyre 6. The boat over _ Is _ boat, and _ going to take me fishing next weekTheir There Theyre 7. Put the book over _ next to _ shelves because _ going to put the books in order Their There Theyre Name the transformation if the new coordinates are (- 1, 1), (- 5, 1), (- 1, 3) HELP NOW PLEASE ANSWER ASAP RIGHT NOW ASAP PLEASE ANSWER What does MVLMEN stand for A 39-year-old Maine coon named Gilbert had a birthday party on Saturday. The host of the party was his owner, Debbie Marshall. She was given the cat as a gift on her 5th birthday. Marshalls daughter and grandson were also at the party. Reporters from around the state came to the party as well. Marshall was shocked by the attention she and Gilbert were getting. "I never knew that having an old cat was such a big deal," she said. "My friend said that a 39-year-old cat had to be a record. I did not think it was true!" Gilbert is the oldest living cat in the world. The next oldest is a 36-year-old Bombay that lives in Mumbai. *30 POINTS* HELP FOR BRAINLIEST : How do you think these geographic features influenced where people settled? Describe the relations between Islam and eastern and Western Europe. Were there moments of war and diplomacy? Trade? Explain in detail with specific examples 4 3/12 + 1 4/12 = (make sure you simplify the fraction) i need help plz it would mean a lot After World War II, the legal basis for the criminal trials of German and Japanese wartime officials by the Allies was that these officials had1overthrown monarchies by force2violated nonaggression pacts3committed crimes against humanity4established communist police states Circle the word that SIGNALS an argument. Underline the phrases that give the authors claim Highlight in yellow the reasons in the authors claim Find the COUNTERCLAIM - underline that Highlight in another color, the reasons for the COUNTERCLAIM. SAVE SPIRIT WEEK By David Pinsky Teachers at Harrison Middle school feel that Spirit week should be canceled. They argue that it interrupts classes in many ways. Students may forget to do their homework as they concentrate on the Spirit Week themes. A few students skip classes and some go to a different lunch period. Students spend extra time in the bathrooms combing their hair and adjusting their outfits. Some students goof around in class and find it hard to settle down. If Spirit Week isnt canceled, teachers warn that school will no longer be a good place to learn. We, the students, feel that Spirit Week encourages us to be better students. Spirit Week is a way for us to show our creativity. For example, last year we had a 70s theme. Students learned how a person dressed during this decade, and they tried to imitate those fashions. Such a theme teaches us about culture and history. Spirit week also gives us feelings of pride. At the end of the week, we wear our school colors and support our basketball team against our rivals, the Wildcats. Finally, we feel that Spirit Week teaches us how to work in groups and how to pan and organize an event. Everyone loves Spirit Week. We ask the Harrison School Board to consider our plea and save Spirit Weekplease helpppppppppppppppppppppppp If youre a Muslim, please do answer my question. Ill mark you as brainlist! just want to check up on you all :)-Hows your Ramadan going so far?Write it in 5-7 sentence plz PLEASE HELP FaSt i WILL GIVE BRAINLEiST What phrase in Senator Hatch's statement shows that his support forprovisions of the PATRIOT Act began even before September 11,2001? Segn la informacin en la leccin a qu obras dedic sus ltimos aos de vida, despus de 1610?a. La Cueva de SalamancaC. El Viejo Celosob. Los Trabajos de Persiles y Segismuda d. El Juez de los DivorciosPlease select the best answer from the choices provided hii! please help asap. ill give brainliest