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
GrogVix [38]
3 years ago
6

Write a method string gettimename (int hours, int minutes) that returns the english name for a point in time, such as "ten minut

es past two", "half past three", "a quarter to four", or "five o'clock". assume that hours is between 1 and 12.
English
2 answers:
3241004551 [841]3 years ago
6 0

Answer:

// Program is written in Java Programming Language

// Comments are used for explanatory purpose

// Program starts here

public static String getTimeName(int hours, int minutes) {

// Check for valid time

if ((hours >= 1 && hours <= 12) && (minutes >= 0 && minutes <= 59)) {

// Create an array to hold valid minutes in English

String validminutes[] = {

"", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty", "Twenty one", "Twenty two", "Twenty three", "Twenty four", "Twenty five", "Twenty six", "Twenty seven", "Twenty eight", "Twenty nine" };

String validtime;

// Start Conversion

if (hours == 12){ // Set time to be One

validtime = validminutes[1];}

else{ // Set time to be ahead by one hour

validtime = validminutes[hours + 1]; }

// Check for minutes

if (minutes == 0){ // Replace 0 with O' Clock

System.out.println(validminutes[hours] + "O' Clock");}

else if (minutes == 15){// Replace with quarter past

System.out.println("Quarter past " + validminutes[hours]);}

else if (minutes == 30){// Replace with half past

System.out.println("Half past" + validminutes[hours]);}

else if (minutes == 45){// Replace with quarter to

System.out.println("Quarter to" + a);}

else if (minutes < 30){ // for other minutes between 1-29

System.out.println(validminutes[minutes] + " " + "past" + validminutes[hours]);}

else{ // Other minutes

System.out.println(hour_mint[60 - minutes] + " " + "to " +validtime);}

}

// End of Valid Time

else { // Invalid Tine

System.out.println("Time not valid ");

}

}

// End of Program

artcher [175]3 years ago
4 0
Hi!!

Hope I understood your question...

Ten minutes past two = two ten
half past three = three thirty
a quarter to four = four forty-five
Five o'clock = five

then you can add a.m or p.m.

Hope I helped !!

You might be interested in
Cassie was having a great time at summer camp. She loved her counselor and
r-ruslan [8.4K]

Answer:

Sharing is Caring

Explanation:

7 0
3 years ago
What are the features of a ballad?
-BARSIC- [3]

Answer:

Ballads are often 13 lines with an ABABBCBC form, consisting of couplets (two lines) of rhymed verse, each of 14 syllables. Another common form is ABAB or ABCB repeated, in alternating eight and six syllable lines. Many ballads were written and sold as single sheet broadsides.

HOPE THIS HELPS!!!! PLEASE VOTE BRAINLIEST!!!!

8 0
3 years ago
The effect of technology on youth education???
Nataly [62]
It has a bad effect and a good effect it has a bad affect because it can cause u to cheat it has a good effect because it can give u something that u haven't learned before it can cause u to learn more but technology sometimes won't be there on on a test or classwork or quiz so don't get used to it
6 0
3 years ago
Read 2 more answers
How can I describe the setting of a book without using plot summary (please explain, I need help maybe, ex.)​
ruslelena [56]

Answer:

The setting of a book is the time and geographic location within a narrative. It is a literary element. The setting initiates the main backdrop and mood for a story. So, you don't need a plot summary - all you need to know is where the book takes place and when, and describe it. Emphasise it. Go around it, and elaborate.

Explanation:

I hope this helps. Let me know if you require further assistance.

- profparis

5 0
2 years ago
What is health 100 word essay​
Trava [24]
Health is a persons mental or physical condition. Health can be provided in many ways to people. For Instance, a girl a ill. You can tell that there health is not well.
5 0
3 years ago
Other questions:
  • Does anyone know the answer?
    9·2 answers
  • "seventh grade" is a narrative. how is this form of writing different from a persuasive text?
    12·1 answer
  • Which statement is an example of an i-st
    15·1 answer
  • What does the following phrase mean, "those who are between 60 and 80 years are in Act IV of the five parts of their existence"?
    12·1 answer
  • Which of the following corrects the error in meaning and usage in the sentence below? Our first goal is to pacifist those who ha
    14·2 answers
  • What are the types of figurative language?
    10·1 answer
  • Evaluate Perseus's conclusion that Hermes possessed magical powers. (Cite evidence to support your position)
    6·2 answers
  • Read the poem “Long, Too Long America” by Walt Whitman. What is the form of this poem?
    11·1 answer
  • What does the phrase “asphalt flowers” mean in line 9?
    13·2 answers
  • What is a words that replace nouns and can perform the same functions as nouns
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!