63 095
Assignments Done
99%
Successfully Done
In July 2018

Answer to Question #13355 in C# for Sifsilva

Question #13355
Phone call cost 10 cents per minute. Write a program that generate two random numbers and calculate the cost of the call.
When a button is clicked ,two random numbers are generated,.A call cannot be more than 5 hours long.The generated hours and minutes are displayed on labels.
When a button is clicked ,two random numbers are generated,.A call cannot be more than 5 hours long.The generated hours and minutes are displayed on labels. How to Calculate the cost of the call in minutes and display it on a label?

Expert's answer
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();
label1.Text = "";
label2.Text = "";
label3.Text = "";
& }

& private void button1_Click(object sender, EventArgs e)
& {
int hour, minutes;
Random random = new Random();
hour = random.Next(0,4);
minutes = random.Next(0,59);
label1.Text = Convert.ToString(hour);
label2.Text = ": quot; + Convert.ToString(minutes);
int cost = (minutes + (60 * hour)) * 10;
label3.Text = Convert.ToString(cost);
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions