CodeGym
Promotion
CodeGym University
Learning
Course
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Question
  • Reviews
  • About us
Start
Start learning
Start learning now
  • All questions
hidden #10589341
Level 19
  • 22.02.2020
  • 599views
  • 2comments

help me

Question about the task Time conversion
Java Syntax,  Level 3,  Lesson 5
Under discussion


Add a public static int convertToSeconds(int hour) method that converts hours to seconds.
Call it twice in the main method with any arguments.
Display the results, each time on a new line.

Requirements:
  • Add the convertToSeconds method. It must be public static, and take and return ints.
  • The convertToSeconds method must convert the passed number of hours to seconds.
  • The main method must call the convertToSeconds method twice.
  • The main method should display the result of the calls, each time on a new line.
  • The convertToSeconds method should not display anything.
package com.codegym.task.task03.task0312; /* Time conversion */ public class Solution { //write your code here public static int convertTOSeconds(int hour) { int second = hour * 3600; return second; } public static void main(String[] args) { //write your code here System.out.println(convertTOSeconds(35)); System.out.println(convertTOSeconds(18)); } }
0
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Guadalupe Gagnon
Level 37 , Tampa, United States
22 February 2020, 05:46
convertToSeconds not convertTOSeconds The verification system can't test your code because it is calling the method as it should appear, but it does not appear in your code.
+1
hidden #10589341
Level 19
22 February 2020, 06:54
thank u
+1
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Game Projects
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning and Java developer’s career.
Follow us
Interface language
Programmers Are Made, Not Born © 2023 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2023 CodeGym
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.