In Exercise P3.13 you were asked to write a
public static String romanDigit(int n, String one, String five, String ten)
That method translates one digit, using the strings specified for the one, five, and ten values. You would call the method as follows:
romanOnes = romanDigit(n % 10, “I”, “V”, “X”);
n = n / 10;
romanTens = romanDigit(n % 10, “X”, “L”, “C”);
…
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Big Java Late Objects
Additional Engineering Textbook Solutions
Modern Database Management (12th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Java How To Program (Early Objects)
C Programming Language
- in python "AnagramMake a method is_anagram_of(a,b) that tests if a is an anagram of b.A string a is an anagram of a string b, if it uses exactly the same letters, but the order can be different.Spaces are ignored, as well as capitalization.Examples of anagrams:"eleven plus two" - "twelve plus one""William Shakespeare" - "I am a weakish speller""Tom Marvolo Riddle" - "I am Lord Voldemort""Anagrams" - "Ars manga""television ads" - "enslave idiots"Counter examples:"bla" - "aalb""cat" - "tact"Hint: Make a dictionary that holds how often a letter occurs in a word."""def is_anagram_of(a, b):passarrow_forwardWrite a program that prompts the user to enter adecimal number and displays the number in a fraction. (Hint: read the decimalnumber as a string, extract the integer part and fractional part from the string,and use the BigInteger implementation of the Rational class in Programming to obtain a rational number for the decimal number.) Here are somesample runs: Enter a decimal number: 3.25 ↵EnterThe fraction number is 13/4 Enter a decimal number: –0.45452 ↵EnterThe fraction number is –11363/25000arrow_forwardJava: Class: MiddleStr Write a method public static String middle(String str) that returns a string containing the middle character in str if the length of str is odd, or the two middle characters if the length is even. For example, middle("middle") returns "dd". Write a test program [main()] to test the method.arrow_forward
- PLEASE HELP ME FIND THE JAVA CODE FOR THIS PROBLEM 4. Is It You, Cody? by CodeChum Admin Can you identify if Cody's name is spelled right? If so, then make a program that accepts four one-letter strings separated by space and print "Correct" if the inputted strings, combined in order, spell the name Cody correctly. If not, print "Wrong". It doesn't matter if it's in uppercase or lowercase, as long as it's spelled correctly, it's considered correct. Now, will you take on this task? Input A line containing four one-letter strings separated by a space. c·O·D·y Output A line containing a string. Correctarrow_forwardComputer programmin Javaarrow_forwardIn Java pleasearrow_forward
- Java - Musical Note Frequenciesarrow_forwardLanguage: Java Write a program that reads a sentence from the keyboard. Depending on the last character of the sentence, print the message identifying the sentence as declarative (ends with a period), interrogative (ends with a question mark), exclamatory (end with an exclamation point), or other. Hint: you can use charAt() method from the String class to extract the last character of the input line. The character of a String str is at str.length()-1 position. For taking a sentence as input use the nextLine() method from the Scanner class. You have to use if/else if selection. Sample input and output: Sample 1 Input: How are you? Output: Interrogative Sample 2 Input: I am good. Output: Declarative Sample 3 Input: That is amazing! Output: Exclamatory Sample 4 Input: Although, Output: Other Answer:arrow_forwardJava program:; User's name. Write a program that prompts for and reads the user's first and last name (separately). Then print a string composed of the first letter of the user's first name, followed by the first five characters of the user's last name, followed by a random number in the range 10 to 99. Assume that the name is at least five letters long. Similar algorithms are sometimes used to generate user names for new computer accounts. wwwarrow_forward
- Javaarrow_forwardWrite a method that finds the number of occurrences of a specified character in a string using thefollowing header:public static int countLetter(String str, char ch)Write a test program that prompts the user to enter a word and a letter of the alphabet. Theprogram should then count and display the number of occurrences of the letter in the word. Asample dialog for the program is shown below:arrow_forwardIn java language has three different method Write the method xyzMiddle().** Given a String str, does "xyz" appear in the* "middle" of the string. To define middle, we'll* say that the number characters to the left and* right of the "xyz" must differ by, at most, one.** Examples:* xyzMiddle("AAxyzBB") returns true* xyzMiddle("AxyzBB") returns true* xyzMiddle("AxyzBBB") returns false** @param str the String to examine.* @return true if xyz is in the "middle" of str.*/// TODO - Write the method xyZMiddle here. /*** Write the method named repeatSeparator().** Given two String inputs, word and separator,* along with a third int input count, return a* big String consisting of count copies of word,* each separated by separator.** Note: This is a very common algorithm, called the* fencepost algorithm, because just like building a* fence, you need 11 fenceposts to hold up 10 sections* of fence.** Examples:* repeatSeparator("Word", "X", 3) returns "WordXWordXWord"* repeatSeparator("This", "And",…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education