Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

C# Programming help


  • Please log in to reply
2 replies to this topic

#1 vc92

vc92

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Local time:01:19 AM

Posted 06 October 2012 - 07:01 PM

Hi there Programmers !

Im having a little trouble on my assignment homework i have, hopefully you guys can help me out here

the question is ..

Running on a particular treadmill, you burn 3.9 calories per minute. Create an application that uses a loop to display the number of calories burned after 10,15,20,25,30 minutes. Display the output in a ListBox control.

heres what i have for my coding so far...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void calculateButton_Click(object sender, EventArgs e)
        {
            int minutes;
            int calories;

            for (minutes = 10; minutes <= 30; minutes = minutes + 5);       
         {

              calories = minutes * 3.9;




am i on the right track ??

I dont know what comes after that ...

thanks for the help

Edited by vc92, 06 October 2012 - 07:02 PM.


BC AdBot (Login to Remove)

 


#2 DarkSnake-Kobra

DarkSnake-Kobra

  • Members
  • 633 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Iowa, USA
  • Local time:04:19 AM

Posted 06 October 2012 - 11:47 PM

:welcome:

Unfortunately we can't help you with your homework. You should ask your teacher or classmates for any help you may need.

#3 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:03:19 AM

Posted 07 October 2012 - 01:01 PM

As mentioned, we won't help with homework, but we can help maybe break the problem down. At any rate, the way you have done it is one way to do it. You could also start looping at 10, and just display the total if minutes is divisible by 10 with no remainders (think mod division).

This is a verys simple assignment with a very simple loop. Do not over think it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users