C++ PROGRAMMING LMS MINDTAP
8th Edition
ISBN: 9781337696173
Author: Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Question
Chapter 10, Problem 6PE
Program Plan Intro
Implementation of a program to display the roman numeral or a positive integer.
Program Plan:
Write a C++ program with a main function and the required set of statements to accomplish the following:
Create a class romanType and declare the required variables and the member functions as well.
Define of the function set_Roman to store the number as a Roman numeral.
Then define the function to convert the roman number entered by the user to integer.
Definition of the function print_Roman to print the number as roman numeral
Define the function print_Integer to print the roman numeral as positive integer.
In the main function, we have to call all the functions as mentioned above.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Write a program that converts a number entered in Roman numerals to a positive integer. Your program should consist of a class, say, roman type. An object of type roman type should do the following:
a.Store the number as a Roman numeral.
b.Convert and store the number as a positive integer.
c.Print the number as a Roman numeral or positive integer as requested by the user.
The integer values of the Roman numerals are:
M
100
D
500
c
100
L
50
x
10
v
5
I
1
d. Test your program using the following Roman numerals: Mcxiv, Ccclix, and Mdclxvi.
Write a program that converts a number entered in Roman numerals to decimal. your program should consist of a class, say, Roman. An object of type Roman should do the following:a. Store the number as a Roman numeral.b. convert and store the number into decimal.c. print the number as a Roman numeral or decimal number as requested by the user.the decimal number values of the Roman numerals are:M 1000D 500C 100L 50X 10V 5I 1
Write a program that converts a number entered in Roman numerals to a positive integer. Your program should consist of a class, say, romanType. An object of type romanType should do the following: a. Store the number as a Roman numeral. b. Convert and store the number as a positive integer. c. Print the number as a Roman numeral or positive integer as requested by the
Chapter 10 Solutions
C++ PROGRAMMING LMS MINDTAP
Ch. 10 - Mark the following statements as true or false....Ch. 10 - Find the syntax errors in the following class...Ch. 10 - Find the syntax errors in the following class...Ch. 10 -
Find the syntax errors in the following class...Ch. 10 -
Find the syntax errors in the following class...Ch. 10 - Prob. 6SACh. 10 - Assume the definition of class foodType as given...Ch. 10 -
Consider the definition of the following class:...Ch. 10 - Consider the definition of the class product Type...Ch. 10 -
Consider the definition of the class product Type...
Ch. 10 - Prob. 11SACh. 10 -
Assume the definition of class houseType as given...Ch. 10 - Chapter 9 defined the struct studentType to...Ch. 10 - Write a program that uses the class productType...Ch. 10 -
Write a program that uses the class houseType...Ch. 10 - Prob. 6PECh. 10 - Prob. 7PECh. 10 - Some of the characteristics of a book are the...Ch. 10 - Define the class bankAccount to implement the...
Knowledge Booster
Similar questions
- JAVA Write an application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent.arrow_forwardThe local Driver’s License Office has asked you to write a program that grades the written portion of the driver’s license exam. The exam has 10 multiple-choice questions. Here are the correct answers: 1. B 2. D 3. A 4. A 5. C 6. A 7. B 8. A 9. C 10. D A student must correctly answer 7 of the 10 questions to pass the exam. Write a class named DriverExam that holds the correct answers to the exam in an array field. The class should also have an array field that holds the student’s answers. The class should have the following methods: • passed. Returns true if the student passed the exam, or false if the student failed. • totalCorrect. Returns the total number of correctly answered questions. • totalIncorrect. Returns the total number of incorrectly answered questions. • questionsMissed. An int array containing the question numbers of the questions that the student missed, i.e. answered incorrectly. Test the class in a separate class, DriverTest , that asks the user to enter a student’s…arrow_forwardA java programarrow_forward
- I need the answer as soon as possiblearrow_forwardSome Websites impose certain rules for passwords, involving use of certain numbers and special characters. Write a Python program (Console and GUI) that prompts the user to enter a password and displays "valid password" if the rule is follows rules of the company, or "invalid password" otherwise. Write a method or a function for implementing the password checking rules for the method/function as follows: A password must have at least eight characters. A password must consist of only letters and digits. A password must contain at least two digits. Sample 1 Enter a string for password: wewew43x valid password Sample 2 Enter a string for password: 343a invalid passwordarrow_forward1. Write a class to calculate the distance between two massive objects using using Newton's law of universal gravitation. Use it to determine the distance between the Earth and the Moon in kilometres. Then use it to determine the distance between the Earth and the Sun in kilometres. ?=??1?2?2F=Gm1m2r2 You may find the following values useful: Gravitational Constant: ?=6.674×10−11 m3kg−1s−2G=6.674×10−11 m3kg−1s−2 Mass of the Earth: ?⊕=5.972×1024 kgM⊕=5.972×1024 kg Mass of the Moon: ?=7.348×1022 kgm=7.348×1022 kg Mass of the Sun: ?⊙=1.989×1030 kgM⊙=1.989×1030 kg Force of attraction between the Earth and the Moon: ?=1.986×1020 NF=1.986×1020 N Force of attraction between the Earth and the Sun: ?=3.6×1022 NF=3.6×1022 N Please give proper explanation and typed answer only.arrow_forward
- FOR JAVA Create a class named Product that has ID, price and stock as fields. This class must have two constructors; one constructor must take all its fields as parameters, second constructor must take ID and price as parameters and set stock to 0. Also implement the following methods: • String toString(): Returns a brief summary about the object. • void sell(int): Takes a parameter that represents the amount to sell. Checks if stocks are sufficient. If so, it updates the stock and prints the total price. Else it prints a warning to user. Create 3 instances of Product class and test your methods.arrow_forwardIn this exercise you will write a program to compute the distance between any two geo locations. In this program you will ask the user for four numbers. starting latitude starting longitude ending latitude ending longitude Then, using the GeoLocation class and our earlier example as a reference, compute the distance in miles between the two locations. A sample program run should match exactly as below: Enter the latitude of the starting location: 48.8567 Enter the longitude of the starting location: 2.3508 Enter the latitude of the ending location: 51.5072 Enter the longitude of the ending location: 0.1275 The distance is 208.08639358288565 miles. setInputs(String[]) should be included /* * This class stores information about a location on Earth. Locations are * specified using latitude and longitude. The class includes a method for * computing the distance between two locations. * * This implementation is based off of the example from Stuart Reges at * the University of…arrow_forwardThis is the tester of two classesarrow_forward
- In a Java program, create an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present in your automobile class: private string make, private string model, private string color, private int year, private int mileage. Your program should have appropriate methods such as: constructor, add a new vehicle, remove a vehicle, update vehicle attributes. At the end of your program, it should allow the user to output all vehicle inventory to a text file.arrow_forwardIn this exercise, you have to implement a calculator which can perform addition, subtraction, multiplication, and division. Problem Statement# Write a Java class called Calculator with ● private fields: ○ num1 and num2 (double type) And methods: ● add(), a method which returns the addition of two numbers ● subtract(), a method which returns the subtraction of num1 from num2 ● multiply(), a method which returns the multiplication of numbers ● divide(), a method which returns the division of num2 by num1 ● Define a parameterized constructor which takes two parameters num1 and num2 and assigns these variables to the respective fields in the class. Input# Pass double point numbers in the parameterized constructor Output# addition, subtraction, division, and multiplication Sample Input# Calculator obj = new Calculator(10, 94); obj.add() obj.subtract() obj.multiply() obj.divide() Sample Output# 104 84 940 9.4 Part of the Solution class Calculator { // write class fields here public…arrow_forwardWrite a Java application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent.Your application should roll the dice 12 times. Use a one-dimensional array to tally the number of times each possible sum appears. Display the results in tabular format. */arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT