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_forwardDo in Java language, filename wealth.javaarrow_forward
- A 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_forwardWrite 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_forward
- 1. 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_forwardJavaarrow_forward
- In 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_forwardIn 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_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
- 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