Question

I am writing a Python program to serve as a fitness tracker. I would love some...

I am writing a Python program to serve as a fitness tracker. I would love some input as to how you would code this. I've included what I want this program to accomplish, what I will keep track of, and below all of that I have posted the assignment guidelines. Any suggestions on how to make this better/ more efficient would be welcome! I'm thinking of making a weekly tracker that takes input per day, and outputs at the end of the week the amount of exercise and if goals were met. Could be a monthly accumulation, but weekly would be easier.

Fitness Tracker: To determine if fitness goals were met.

Set goal (minimum): 4 yoga classes per week. Per day: 20 min of exercise (cardio, weights, body weight resistance), 10 min of meditation/stretching

Input daily, but you can input it all at the end of the week if you want.

Maybe I should prompt the user to enter the date and keep track in a range of 7 days and start there.

Output: Weekly amount: Amount of exercise (yoga classes taken, Min of exercise per type, min of stretch/meditation). Determine if goals were met. Ouput time should be in hours.

Below are the assignment requirements. A test plan is also required.

  • Full pseudocode should be included in the comments.
  • It must have at least one input and at least one output.
  • It must validate the user input. This means the user is not allowed to just enter any value. You must check the value, and ask the user to enter it again, and repeat this loop until the user enters a valid value.
  • Your program must use at least two loops in meaningful ways. The loops you use for input validation count for at most one of the two required loops. If you use loops to validate two separate inputs, that does not count as two loops for satisfying this lab requirement.
  • It should be organized into separate modules (one module for input, one module for output, and one module for each separate calculation or action that the program is to perform [that is, each module should be "cohesive" and should only do one thing]).
  • Use parameters and arguments to pass values into your modules (don't use global variables).
  • The Python code should run correctly, and the logic should match your pseudocode.

The test plan document Lab4-TestPlan should meet all of the following requirements:

  • Follow the format given in the example test plans (one below, and one on the Testingpage). You can download and copy the test plan document below and use it as a template: replace the content of each section with your own content.
  • Write the test plan as if for someone who cannot see your source code (utilize black-box testing). They can only run the program, provide inputs, and observe outputs.
  • For each test case, include at least the following fields: Summary, Test Procedure, Test Data, Expected Result. Feel free to add more fields if you want to. (See Test Case for additional fields.)
  • Include test cases for all important categories of input (valid, invalid, boundary, etc.). If your program passes every test case in your test plan, you should be confident that it functions correctly.
    • Be sure to run your program against the test plan to determine its correctness, and fix any bugs found.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is a small program, I just thought about it with your inputs. Hope it helps you. Here is the code and screenshot of the actual run

------------------------------------------------------------------------------------------------------------------------------------------

def get_user_time(type):
    did_ = input('Did you do ' + type + '? (yes/no): ')
    if did_.lower() == 'no':
        return 0
    else:
        time = float(input('Enter how long you did ' + type + '? (mins): '))
        return time

def main():
    duration=[0,0,0]
    types=['yoga','cardio','meditation']
    days=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']
    print('Welcome to Fitness Tracker')

    for day in range(1,8,1):
        print('Day -', days[day-1])
        for type in types:
            time=get_user_time(type)
            if type=='yoga':
                duration[0]+=time
            elif type=='cardio':
                duration[1]+=time
            else:
                duration[2]+=time

    if sum(duration)>=3*20*7:
        print('Your fitness score is 5 on scale of 5.0')
    elif sum(duration)>=3*20*7*0.8:
        print('Your fitness score is 4 on scale of 5.0')
    elif sum(duration)>=3*20*7*0.6:
        print('Your fitness score is 3 on scale of 5.0')
    elif sum(duration)>=3*20*7*0.4:
        print('Your fitness score is 2 on scale of 5.0')
    else :
        print('Your fitness score is 1 on scale of 5.0')


main()

------------------------------------------------------------------------------------------------------------------------------------------

Run: FitnessTracker Did you do yoga? (yes/no): yes Did you do cardio? (yes/no): no Enter how long you did yoga? (mins): 10 Di

Add a comment
Know the answer?
Add Answer to:
I am writing a Python program to serve as a fitness tracker. I would love some...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lab 5 Instructions For Lab 5, you will be writing a more complex modular program that...

    Lab 5 Instructions For Lab 5, you will be writing a more complex modular program that uses at least two arrays, and has at least one loop that accesses the data in the arrays. As long as your program satisfies the requirements listed below, you are free to design and write any type of program that you care to. You are encouraged to be creative, and pick something that has meaning for you, because you'll have more fun. Feel free...

  • [PYTHON] Create a chatbot program in Python: a program that appears to talk intelligently to a...

    [PYTHON] Create a chatbot program in Python: a program that appears to talk intelligently to a human using text. Your program should involve asking the user questions and having the computer respond in a reasonably intelligent fashion based on those answers. For example, here is a sample chat: ChatBot: Welcome, I am Chatbot . What is your name? User: My name is Abby . ChatBot: Hello Abby. How old are you? User: 22. <---- Input ChatBot: That is older than...

  • I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply t...

    I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply this with flowchart? Module main()   Call getDailyProfit()   Call calculateWeeklyProfit() Call main() Module getDailyProfit()   // Declare all variables and establish the array          Constant Real SIZE = 7          Declare String days[SIZE] = Sunday, Monday, Tuesday, Thursday. Friday, Saturday          Declare Real days          Declare Real number          Declare Real Index             //Prompt the user for profit information for Sunday          Display “How...

  • Hello, I am wondering what the source code for this problem would be. Thank you so...

    Hello, I am wondering what the source code for this problem would be. Thank you so much. You will write a java program using the Eclipse IDE. The program will allow a user to perform one of two options. The user can look up the dates for a given zodiac sign or enter a date and find what sign corresponds to that date. SIGN START DATE END DATE Aries 3/21 4/19 Taurus 4/20 5/20 Gemini 5/21 6/20 Cancer 6/21 7/22...

  • This is a c++ question note: not using  namespace std; at the beginning of the program Writing...

    This is a c++ question note: not using  namespace std; at the beginning of the program Writing Data to a File This program will write a series of letters, starting with 'A', to an external file (letters.txt). The user will decide how many letters in total get saved to the file. ** IMPORTANT: The test cases will evaluate your code against .txt files that I uploaded. You do NOT have to upload your own txt files. Input: Including 'A', how many...

  • (I would like this to be in five parts.) Write a program (Python module) that includes...

    (I would like this to be in five parts.) Write a program (Python module) that includes a function named studentrecords. This function must support execution of two loops. The first loop is to query the user whether they wish to enter additional records or not. It must accept responses of either yes or no as input, regardless of the letter-cases used for individual letters in the response. If the response is not recognized ( it isn’t yes or no) it...

  • I need help in Python. This is a two step problem So I have the code...

    I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...

  • You are to write a basic fitness application, in C++, that allows the user of the...

    You are to write a basic fitness application, in C++, that allows the user of the application to manually edit “diet” and “exercise” plans. For this application you will need to create three classes: DietPlan, ExercisePlan, and FitnessAppWrapper. Diet Plan Attributes: The class DietPlan is used to represent a daily diet plan. Your class must include three data members to represent your goal calories (an integer), plan name (a std::string), and date for which the plan is intended (a std::string)....

  • . Discussion will include aerobic, strength and flexibility components. If you already have a regular exercise program,...

    . Discussion will include aerobic, strength and flexibility components. If you already have a regular exercise program, you will evaluate and critique each area of your program, commenting on the strengths and weaknesses of that program as it relates to the principles of F.I.T.T. Why did you choose this program and how is it helping you to reach your goals? What progress/success have you had with the program? What challenges do you face in continuing this program? Do you need...

  • In Python Exercise – For & While Loops Create a new file called loops.py and use...

    In Python Exercise – For & While Loops Create a new file called loops.py and use it for all parts of this exercise. Remember the difference between input and raw input? Be sure to test your code for each part before moving on to the next part. Write a program using a for loop that calculates exponentials. Your program should ask the user for a base base and an exponent exp, and calculate baseexp. Write a program using a while...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT