Write a program that displays a table of ten distance equivalents in miles and kilometers. See Example output. You must generate the table by running a function inside a loop in main. Generate a random integer from 10 to 60, inclusive, in each loop cycle. Use this latter value as the miles argument to the function. The function must then print a line in the table. Repeat: The function prints the table.  Print  the miles in a column 5 characters wide with 2 decimals and the kilometers in a column 13 characters wide with 5 decimals. Use the column formatting concepts at the end of Chapter 2, not tabs or other methods not in this course. Example output MILES   KILOMETERS 52.00     83.68568 11.00     17.70274 40.00     64.37360 21.00     33.79614 14.00     22.53076 23.00     37.01482 48.00     77.24832 22.00     35.40548 15.00     24.14010 16.00     25.74944

Question

Hi! I need assistance writing the PSEUDOCODE and the SOURCE CODE for the problem listed below! Any help is appreciated, thank you! Its suppose to be in Python.

To do program5_2 you will need program5_1(at the bottom of this), I DO NOT need that program solved. Just program5_2. Thank you so much in advance.

program5_2.py
Write another program that generates another table with the same columns and decimals but by using a function that returns the kilometers for a specified miles parameter. Use a loop in main and generate random integers as before, but catch the value returned by the function and use it in the loop to print a line of the table. Repeat: The table is printed in main

 

 

 

Program5_1 for reference:

program5_1.py
Write a program that displays a table of ten distance equivalents in miles and kilometers. See Example output. You must generate the table by running a function inside a loop in main. Generate a random integer from 10 to 60, inclusive, in each loop cycle. Use this latter value as the miles argument to the function. The function must then print a line in the table. Repeat: The function prints the table.  Print  the miles in a column 5 characters wide with 2 decimals and the kilometers in a column 13 characters wide with 5 decimals. Use the column formatting concepts at the end of Chapter 2, not tabs or other methods not in this course.

Example output

MILES   KILOMETERS
52.00     83.68568
11.00     17.70274
40.00     64.37360
21.00     33.79614
14.00     22.53076
23.00     37.01482
48.00     77.24832
22.00     35.40548
15.00     24.14010
16.00     25.74944

Expert Answer

1 Rating

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Engineering

Programing

Related Computer Engineering Q&A

Find answers to questions asked by students like you.

Q: Create a program in c ++ to convert the distance. Choose from the choices below. a - meters to kilom...

A: Program: #include <iostream> #include<bits/stdc++.h> using namespace std; int main() {  ...

Q: In Python: Write a class named Pet, which should have the following data attributes:   _ _name (for ...

A: Actually, as per the program given Steps will followed : Pet Class to achieve the following :1) Defi...

Q: Case Problem 1 The administrators of Tiny College are so pleased with your design and implementati...

A: For their motor vehicle pool, the Tiny College administrators manage the database. The following lis...

Q: For a given integer n>1, the smallest integer d>1 that divides n is a prime factor. We can fin...

A: Actually, java is a object oriented programming language.  

Q: QUESTION 5 A 'block' in virtual memory is called a: O page O page fault O cache O block

A: Virtual memory: It is a type of memory which exists in Operating system. In this memory is allocated...

Q: Write a python program to store first year percentage of students in array. Write function for sorti...

A: n is a user-defined integer variable used to store the value of the number of students in the first ...

Q: Create a Java program. You have a list of Student ID's followed by the course number(separated by aa...

A: Below code contains HashMap with Integer as key which stores student ids and ArrayList as value whic...

Q: Q. Write an algorithm, draw a flow chart and also write a C- program to find out area of triangle. A...

A: There are various formula to calculate the area of triangle, here it is calculated using the Heron’s...

Q: A common programming problem is maintaining a list in numerical or alphabetical order. For example, ...

A: package Java.C.c; import java.util.*; import java.lang.*; import java.io.*; class value { staticin...

Q: c++

A: Specifiers can be of access specifier or type specifier Access Specifiers are those which defines th...

Q: data of 700 kbps is to be transmitted over a channel of 5 kHz bandwidth and 200 kbps capacity. The t...

A: Bandwidth B = 5 kHz Data Rate, C = 700 kbps  

Q: The mirror symmetry about the X axis of a 2D figure centered at the origin involves changing the sig...

A: As the transformation is about the X axis, the X coordinate will stay unchanged and the sign of Y co...

Q: Production systems can be classified into four types, describe them briefly, and give one example fo...

A: In the question, We have to describe what the production process is? What are the types of productio...

Q: 3. The table below shows instruction-type breakdown for different programs. Using this data, you w...

A: Execution time = clock rate* CPI ___________________________________________________________________...

Q: How would you decide whether to use a traditional SQL-based API like ODBC/JBDC vs an ORM framework i...

A: The main disadvantage of the traditional SQL-based API like ODBC/JDBC is , the developer need to cod...

Q: Are microcontrollers better than microprocessors? Justify your answer.

A: Microcontrollers and microprocessors Microcontrollers are used for performing a low power applicati...

Q: discuss the use of edge detection technique in image segmentation.why edge detection is important in...

A: The edge of an image reduces considerably the amount of data to be processed but maintains critical ...

Q: Which of the following operator is used to access the members of a structure a. ( )  b.  ....

A: The given information is  Which of the following operator is used to access the members of a structu...

Q: Write a program to read 50 numbers and find maximum number between them

A: The below given C++ program will obey the following rubrics: Including necessary header files. In t...

Q: Develop an outline (major headings and subheadings only) for a project management plan to create a W...

A: Actually, project is a series of tasks that need to be reach a outcome.

Q: write a c++ program which calculate the average of the student and display the corresponding verbal ...

A: Note: You are asking to calculate the average of the student and display the corresponding verbal i...

Q: Q4: Write a program to ask user to enter his date of birth and calculate how many independence days ...

A: Whenever a dividend is divided by divisor, we have two results quotient and remainder The Quotient i...

Q: To make a profit, a local store marks up the prices of its items by a certain percentage. Write a Ja...

A: Note: Below is the required program in java language. Programming Approach: Importing appropriate p...

Q: Q1] A 700 Mbyte CD is used to store PCM voice data. Suppose that a CT voice signal is sampledat 10 k...

A: Click to see the answer

Q: Write an algorithm to input a number. Find its square if the entered number is multiple of 10. If en...

A: The algorithm is given by: Start Read the number as N check if (N%10==0) if true do step 4 else go ...

Q: Q9. i) Complete the Truth Table Cl Truth Table C1 A B B A+B A+AB 0. 1| 1 Prove the following Boolean...

A: Click to see the answer

Q: What are the security techniques/mechanisms that could be applied to vehicular communications or veh...

A: Vehicular communication based on wireless short-range technology enables spontaneous information exc...

Q: Help their can POSSIBLY be more than one correct answer

A: measurements and calculations can be characterized with regards to their accuracy and precision 

Q: Explain relationships among objects and the concept of inheritance.

A: Answer in step2  

Q: Why is there no need for CSMA/CD on a full-duplex Ethernet LAN?

A: Full duplex ethernet LAN Full duplex is a data communications term for sending and receiving data a...

Q: Small example demonstrating memory adress constrats string in java.

A: String: It is an object that is backed internally by a char array, the array is immutable which can...

Q: Write a program to show the stars in the figure below:

A: The programming language we chose is C++

Q: Using while and for statements 1. Create a C++ program with the following:Using while statementGener...

A: Objective: This program would implement while and for statements to print a series of numbers. The p...

Q: 1. For the given Red Black Tree, draw the tree, when the following entries are inserted: Jade, Bob, ...

A: Click to see the answer

Q: php

A: Given code: <?php$book = "Programming";$value = $book[2];echo "value";this is the line which is h...