Concept explainers
Videos
Conversion
Write a program that asks the user to enter a distance in meters. The program will then present the following menu of selections:
- 1. Convert to kilometers
- 2. Convert to inches
- 3. Convert to feet
- 4. Quit the program
The program will convert the distance to kilometers, inches, or feet, depending on the user’s selection. Here are the specific requirements:
- • Write a void method named showKi1ometers, which accepts the number of meters as an argument. The method should display the argument converted to kilometers. Convert the meters to kilometers using the following formula:kilometers = meters * 0.001
- Write a void method named showlnches, which accepts the number of meters as an argument. The method should display the argument converted to inches. Convert the meters to inches using the following formula:inches = meters * 39.37
- Write a void method named showFeet, which accepts the number of meters as an argument. The method should display the argument converted to feet. Convert the meters to feet using the following formula:feet = meters * 3.281
- Write a void method named menu that displays the menu of selections. This method should not accept any arguments.
- The program should continue to display the menu until the user enters 4 to quit the program.
- The program should not accept negative numbers for the distance in meters.
- If the user selects an invalid choice from the menu, the program should display an error message.
Here is an example session with the program, using console input. The user’s input is shown in bold.
Enter a distance in meters: 500 [Enter]
- 1. Convert to kilometers
- 2. Convert to inches
- 3. Convert to feet
- 4. Quit the program
Enter your choice: 1 [Enter]
500 meters is 0.5 kilometers.
- 1. Convert to kilometers
- 2. Convert to inches
- 3. Convert to feet
- 4. Quit the program
Enter your choice: 3 [Enter]
500 meters is 1640.5 feet.
- 1. Convert to kilometers
- 2. Convert to inches
- 3. Convert to feet
- 4. Quit the program
Enter your choice: 4 [Enter]
Bye!
Learn your wayIncludes step-by-step video
Chapter 5 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Starting Out with Python (4th Edition)
Mechanics of Materials (10th Edition)
Problem Solving with C++ (10th Edition)
SURVEY OF OPERATING SYSTEMS
Degarmo's Materials And Processes In Manufacturing
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- Convert the relation Parking Tables to a set of 3NF relations.arrow_forwardPlease original work What is the importance of understanding both DSS models and OLAP in modern business analytics. Reflect on how the combination of these tools can enhance decision-making processes in organizations. Please cite in text references and add weblinksarrow_forwardPlease original work Talk about the role of Decision Support Systems (DSS) in business analytics. What are the major types of models used in DSS: optimization, simulation, forecasting, heuristic, and descriptive models. Talk about the relevance of these models in supporting business decisions. Please cite in text references and add weblinksarrow_forward
- Please original work What are two DSS models (e.g., optimization and forecasting). What are each model’s purpose, advantages, and limitations in the context of business analytics. Talk about some examples of how each model can be applied in real-world business scenarios, particularly in operations, marketing, or finance. Please cite in text references and add weblinksarrow_forwardPlease original work What is Online Analytical Processing (OLAP) and describe its role in DSS. Talk about how OLAP supports multidimensional analysis and decision-making in businesses. Compare how OLAP differs from traditional DSS models in terms of data processing and output. Please cite in text references and weblinksarrow_forwardPlease original work Describe the key steps involved in the modeling process: problem definition, data collection, model formulation, validation, implementation, and refinement. Talk about why each step is critical to ensuring the accuracy and reliability of the model. What are some real-world business example of a problem, and describe how the modeling process could be applied to address it using DSS. Please cite in text references and add weblinksarrow_forward
- You will be using the "usdata" package's "county" data # for this assignment. # You will need to run:# install.packages("usdata")# once to install this library - do not include the# install.packages command in your submission# as it can cause gradescope to fail ## ## ## ## ## DO NOT MODIFY BELOW ## ## ## ## ## library(usdata)county<-as.data.frame(county)county<-county[,1:14]county<-county[rowSums(is.na(county))==0,]# The set.seed command will ensure your results are consistent# each time you run the "source" commandset.seed(311)## ## ## ## ## DO NOT MODIFY ABOVE ## ## ## ## ## # Treating the "county" dataset as the population of US counties# create the dataframe "my.SRS" that represents a simple# random sample of n=250 individual counties from all counties in the US. my.SRS <- NA # Treating the "county" dataset as the population of US counties# create the dataframe "my.Stratified" that represents a stratified# sample of individual counties from all counties in...arrow_forwardPlease answer two JAVA OOP problems.arrow_forwardPlease answer this JAVA OOP problem.arrow_forward
- Answer two JAVA OOP problems.arrow_forward= 3. [40 pts] In the following C program ex2_2.c, we first declare and initialize an array int arr[3] {1,3,5}. Please convert the C code in main function into Assembly language. We provide the array initialization code in ex2_2_assembly.s for reference. Please complete and submit your code. ex2_2.c: #include int main() { } int arr[3] ={1,3,5}; //declare and initialize the array arr int x11 = arr[0]; int x12 = arr[1]; int x13 =x11x12; int x14 = x13 << x11; // "<<" is left shift operator arr[1] arr [2] = x13; = x14; return 0; //no need to convert this line into assembly languagearrow_forwardPlease answer JAVA OOP problem.arrow_forward
- Text book imageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTText book imageProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageText book imageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Text book imageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningText book imageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningText book imageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,