This is for Microsoft Visual C#.NET
Chapter 6 – Looping
Mrs. Smith has negotiated a salary schedule for her job. She will be paid one cent ($0.01) the first day, with the daily rate doubling each day. Write a program that will find her total earnings for 30 days. Inputs should be the starting daily rate, the growth factor, and the total days in the period. Show your results on the console and in a message box.
Day Number : 1
Daily Salary : .01
Total Earned : .01
Day Number : 2
Daily Salary : .02
Total Earned : .03
Day Number : 3
Daily Salary : .04
Total Earned : .07
Day Number : 4
Daily Salary : .08
Total Earned : .15
Day Number : 5
Daily Salary : etc.
Total Earned : etc.
Also, put the code in this format...
(
using System;
using System.Collections.Generic;
using System.Text;
namespace Page_308__4
{
class Program
{
static void Main(string[] args)
{
Code right here.
}
}
}
)
(Without the Parenthesis)
Quid Pro Quo?
Hey! 'viet,
Doesn't "Quid Pro Quo" mean, "Give To Get"?
So tell us, what's in it for us? lol just teasin'!
Sorry, I don't have an answer for your Q...Good luck!
Reply:Alright I sent the email...hope it helps...and went through.
I feel bad doing your homework...but this was cake
doh...it seems that it cut some of my code down with "..."
I could email it to you
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace goofyness
{
class Program
{
static void Main(string[] args)
{
decimal MadeThatDay = 0.01m;
decimal TotalMade = 0;
for (int Day = 1; Day %26lt; 31; Day++)
{
if (Day == 1)
{
TotalMade += MadeThatDay;
Console.WriteLine("Day Number: {0}\nDaily Salary: {1:c}\nTotal Earned: {2:c}\n",
Day, MadeThatDay, TotalMade);
MessageBox.Show(string.Format("Day Number: {0}\nDaily Salary: {1:c}\nTotal Earned: {2:c}\n",
Day, MadeThatDay, TotalMade));
}
else
{
MadeThatDay = MadeThatDay * 2;
TotalMade += MadeThatDay;
Console.WriteLine("Day Number: {0}\nDaily Salary: {1:c}\nTotal Earned: {2:c}\n",
Day, MadeThatDay, TotalMade);
MessageBox.Show(string.Format("Day Number: {0}\nDaily Salary: {1:c}\nTotal Earned: {2:c}\n",
Day, MadeThatDay, TotalMade));
}
}
Console.ReadLine();
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment