Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab5 (10pts) b. The weight in kilograms will need to be formatted to take 10 columns/characters with two decimal places on screen Write a program

image text in transcribed

Lab5 (10pts) b. The weight in kilograms will need to be formatted to take 10 columns/characters with two decimal places on screen Write a program that prompts for a person's name (first and last name) and c. Format the first and last name to take up 15 columns/characters on screen weight in kilograms. The program will perform the following actions: 4. Call convert_weight() function and store the return value 2pts 5. Call display data() function 1pt 1. Use a function, convert_weight(), to convert the weight from kilograms to pounds. The function will take the weight in kilograms as a parameter and return the converted weight (rounded to two decimal places) Note: 1 kilogram =2.2 pounds Example Program: 2. Use a function, display_data(), to display the name, weight in kilograms (rounded to Enter first name: Jane two decimal places), and the converted weight. display_data() function takes the Enter weight: 98.2 name, weight in kilograms, and the weight in pounds as parameters. The function will display the data as shown below Jane Doe Jane Doe 98.2KG216.04LB Program general flow: Important: If your program does not run, that's an automatic 50\% deduction 1. Prompt for the name and weight in kilograms 2. Call convert_weight() function 3. Call display_data[) function Lab submission details Include the following in your program loglc 1. Prompt for the name and weight in kilograms 1 pts 2. Include definition for convert_weight(). Function takes the weight in kilograms as parameter 3pts a. The function calculates and returns the weight in pounds, rounded to two decimal places b. Use the string format method to format the converted weight to two decimal places and return the converted value 3. Define the display_data() function. Function takes the first name, last name, weight in kilograms, and weight in pounds as parameters 3 pts a. The function displays the data formatted

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions