answer.
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]
2 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]2 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]2 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
Daisy Miller symbolizes _____. Select all that apply.
Schach [20]
A---the country of America<span>B---freshness and youth
Hope this helps
The name of Daisy symbolizes more so on the though "He loves me loves me not" insinuating Being young and vibrant and in love
(very similar to the actual flower named "daisy" 's meaning)</span>
7 0
2 years ago
Read 2 more answers
Read these lines written by a narrator:I'm so glad to be out on a walk. Oh. It's a little chillier than I expected. I wish I wou
astraxan [27]
The answer is A, Stream of consciousness.
7 0
2 years ago
Read 2 more answers
write in active voice, "The predicted sharp edges characteristic of a cosmic string were observed by several teams".
jeyben [28]

Answer:

Several teams observed the predicted sharp edges characteristic of a cosmic string.

Explanation:

Active voice is when the subject is followed by the verb and then the object. Whereas, in a passive voice, the object assumes the starting point, folllowed by the verb and then the subject.

The sentence - <em>The predicted sharp edges characteristic of a cosmic string were observed by several teams</em>

is written in the passive voice. So, to change it into the active voice, the subject "several teams" will begin the sentence, followed by the verb "observed" and then the object.

Thus, the final sentence in the active voice will become

Several teams observed the predicted sharp edges characteristic of a cosmic string.

8 0
2 years ago
Discuss two ways in which dramatic tension is built during the trial in how to kill a mockingbird
denis-greek [22]

The two ways in which the dramatic tensions are expressed in the way of humor and suspense

In considering the trail scene most of the trail scene is suspenseful and it was the scene that people have been waiting for so long. The mood is very suspenseful and tensed about the testimony of the crime scene. When the trail continues for a long time it is very difficult to maintain the suspenseful mood.

They are in the edge of Heck Tate and Mayella testimony and finally it was Toms. The response of Tom in the court room was full of humor and it brought a sense of humor among the readers

3 0
2 years ago
Read the excerpt from chapter 8 of The Travels of Marco Polo.
andreev551 [17]

Answer:

It is C to educate readers about how incense is made in Dhofar.

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • Going into a recent election, only about 62% of people old enough to vote were registered. In a community of about 55,200 eligib
    13·1 answer
  • In “Cruel Tribute,” which character’s actions most advance the development of the plot?
    8·1 answer
  • Solve the linear equation:
    6·2 answers
  • Read the passage from The American Plague.
    13·2 answers
  • Dhruv: Let us go for a movie, Madhav.
    15·1 answer
  • Shakespeare shortened some words in his sonnets such as “featur’d” and “remember’d” in order to do what?
    11·2 answers
  • Read the excerpt below and answer the question. “Well,” he says, “there’s excuse for picks and letting-on, in a case like this;
    8·2 answers
  • Which detail from "The Monkey's Paw" most clearly helps create tension?
    14·2 answers
  • How does Ruthanne respond when Hiram mentions the whistling incident?
    5·1 answer
  • How does the advanced technology create the<br><br> dystopian setting? Check all that apply.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!