(Convert decimals to fractious) Write a program that prompts the user to enter a decimal number and displays the number in a fraction. (Hint: read the decimal number as a string, extract the integer part and fractional part from the siring, and use the BigInteger implementation of the Rational class in
Enter a decimal number: 3.25 The fraction number is 13/4 |
Enter a decimal number: –0.45452 The fraction number is –11363/25000 |
Want to see the full answer?
Check out a sample textbook solutionChapter 13 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Database Concepts (8th Edition)
Starting Out with C++: Early Objects (9th Edition)
- 58arrow_forwardQ3: (Tax Calculator) Develop a Java program that determines the total tax for each of four citizens. The tax rate is 10% for earnings up to 50,000 RM earned by each citizen and 15% for all earnings in excess of that ceiling. You are given a list with the citizens’ names and their earnings in a given year. Your program should input this information for each citizen, then determine and display the citizen’s total tax. Use class Scanner to input the data.arrow_forward(In Java language) Create a class Called NetflixDemo Create two objects “user1” and “user2” of the Netflix class pictured below) Set various class variables for the Netflix class using these two objects. Call various methods of Netflix class using these two objects. public class Netflix {public String movies [] = new String[10];public String trendingTop5 [] = new String[5];public String continueWatching [] = new String[5];public String username;public String password;private boolean isAuthenticated;public double balance;public int subscriberSinceYear;public static void logininfo() {Scanner input = new Scanner(System.in);System.out.println("Enter the username");String username = input.nextLine();System.out.println("Enter the password");String password = input.nextLine();boolean isAuthenticated = true;System.out.println(isAuthenticated + " , You have successfully logged in ");System.out.println();}public static void trendingList(){Scanner input = new…arrow_forward
- How do i solve this problem in python? ( has 3 steps)arrow_forwardPLEASE CODE IN PYTHON The Penny Pitch game is popular in amusement parks. Pennies are tossed onto a board that has certain areas marked with different prizes. For example: The prizes available on this board are puzzle, game, ball, poster, and doll. At the end of the game, if all of the squares that say BALL are covered by a penny, the player gets the ball. This is also true for the other prizes. The board is made up of 25 squares (5 x 5). Each prize appears on three randomly chosen squares so that 15 squares contain prizes.In Python, create a PennyPitch application that displays a Penny Pitch board (use [ and ] to indicate squares) with prizes randomly placed and then simulates ten pennies being randomly pitched onto the board. After the pennies have been pitched, the application should display a message indicating which prizes have been won, if any.arrow_forward(Conversions between feet and meters) Write a class that contains the following two methods: /** Convert from feet to meters */ public static double footTOMeter(double foot) /** Convert from meters to feet */ public static double meterToFoot(double meter) The formula for the conversion is: meter = 0.305 * foot foot = 3.279 * meter Write a test program that invokes these methods to display the following tables: Feet Meters Meters Feet 1.0 0.305 20.0 65.574 2.0 0.610 25.0 81.967 ... 9.0 2.745 60.0 196.721 10.0 3.050 65.0 213.115arrow_forward
- C++ programming Language Write a program that converts a number entered in Roman numerals todecimal form. Program should consist of a class, say romanType. Anobject of romanType should do the following:a. Store the number as a Roman numeral.b. Convert and store the number into decimal form.c. Print the number as a Roman numeral or decimal number as requested by the user. (Write two separate functions—one to print the number as aRoman numeral and the other to print the number as a decimal number.)The decimal values of the Roman numerals are:M 1000D 500C 100L 50X 10V 5I 1Remember, a larger numeral preceding a smaller numeral means addition,so LX is 60. A smaller numeral preceding a larger numeral means subtraction, so XL is 40. Any place in a decimal number, such as the 1s place, the10s place, and so on, requires from zero to four Roman numerals. (The program must include implementation files, .cpp and .h )arrow_forwardpython question Implement the following:1) Store the following data into a tuple, colors: red, green,2) Store the following data into a list, shapes: rectangle, circle3) Print the data type of colors and shapes. Just make sure to precisely match the output format below.Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course).Example Outputcolors: <class 'tuple'> | shapes: <class 'list'>arrow_forwardName:- Mit (Question-1) Note:- Please type this java code and also need an output for this given Java program.arrow_forward
- LANGUAGE:JAVA Code the program that converts uppercase letters to lowercase and lowercase letters to uppercase of a word with amaximum length of 25 characters entered from the keyboard. (After the character library functions are explained)arrow_forward(Intro to Java) explain the answers to the below questions using step-by-step explanation.arrow_forwardC++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