Implementation of a
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.
Trending nowThis is a popular solution!
Chapter 10 Solutions
C++ Programming: From Problem Analysis to Program Design
- Write a program in java Write a program that asks the user to enter five test scores. The program should displaya letter grade for each score and the average test score. Write the following methods inthe program:• calcAverage—This method should accept five test scores as arguments and return theaverage of the scores.• determineGrade—This method should accept a test score as an argument and return aletter grade for the score, based on the following grading scale:(attached photo)arrow_forwardJAVA 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_forward
- Do in Java language, filename wealth.javaarrow_forwardA java programarrow_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_forward
- Write a JAVA program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with 6 seats in each row. Rows 1 and 2 are first class, rows 3 to 7 are business class, and rows 8 to 13 are economy class. Your program prompts the user to enter the following information: Ticket type (first class, business class, or economy class) Desired seat ‘*’ indicates that the seat is available; ‘X’ indicates that the seat has been assigned. Make this a menu-driven program; show the user’s choices and allow the user to make the appropriate choices.arrow_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_forwardGiven two integers that represent the miles to drive forward and the miles to drive in reverse as user inputs, create a SimpleCar object that performs the following operations: Drives input number of miles forward Drives input number of miles in reverse Honks the horn Reports car status The SimpleCar class is found in the file SimpleCar.java. Ex: If the input is: 100 4 the output is: beep beep Car has driven: 96 miles // Simulates a simple car with operations to drive and check the odometer.public class SimpleCar { // Number of miles driven private int miles; public SimpleCar(){ miles = 0; } public void drive(int dist){ miles = miles + dist; } public void reverse(int dist){ miles = miles - dist; } public int getOdometer(){ return miles; } public void honkHorn(){ System.out.println("beep beep"); } public void report(){ System.out.println("Car has driven: " + miles + " miles"); } }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_forwardJavaarrow_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_forward
- 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