Question
I need help with the following practice methods using java: public class SomePracticeMethods { /* returns true if c is a Roman numeral or false
I need help with the following practice methods using java:
public class SomePracticeMethods { /* returns true if c is a Roman numeral or false otherwise */ public static boolean isRomanNumeral(char c) { return c == 'I'|| c == 'V'|| c == 'X'|| c =='L'|| c == 'C'||c =='D'||c =='M'; } /* returns true if s consists only of letters that * are also Roman numerals */ public static boolean allRomanNumerals(String s) { return true; }
/* returns the number of letters in s that are * also Roman numerals */ public static int numRomans(String s) { return 0; } /* returns true if s1 and s2 contain * the same number of Roman numerals */ public static boolean sameNumberOfRomans(String s1, String s2) { return true; }
/* returns s repeated numTimes number of times. For example, if s is "banana" and numTimes is 3, the method returns the String "bananabananabanana"
if numTimes<=1, return s. */ public static String repeat(String s, int numTimes) { return ""; }
/* returns the number of hours equivalent * to m number of milliseconds */ public static double millisecondsToHours(double m) { return 0.0; }
/* returns digit d of x. * * For example, if x is 31257 and * d is 2, the method returns 5 (i.e., the hundreds place). * If d were 5, it would return 3 (i.e., the 10,000s place). * * If d is invalid (i.e., less than 1 or greater than the * number of places that x takes up, return 0. * */ public static int getDigit(int x, int d) { return 0; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started