Note that there are some explanatory texts on larger screens.

plurals
  1. POAllow only numbers to be inserted & transform hours to minutes to calculate gold/min - UPDATED
    primarykey
    data
    text
    <p>I have an application that calculates your gold per minute farmed. I want to make an error report that wouldn't allow you to insert any text in the console input where yous hould insert the time and gold(as shown in code below) and show some error message if you do and let you redo the insertion (some sort of loop or if/else thing ...) Hope i made my self clear,thou I'm new to this... so i hope you understand. Here is my code so far : -------------------------------////////// <BR>Update on question because i didn't want to make a new question for the same code :<BR> How do i transform in this code my hours into minutes,the float calculation of 1.2 hours will calculate into 72 minutes not 80.(i've put comment below in code where the problem is)</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace YourGold { class Program { static void Main(string[] args) { Console.WriteLine("Welcome to YourGold App! \n------------------------"); Console.WriteLine("Inesrt your gold: "); int gold = int.Parse(Console.ReadLine()); Console.WriteLine("Your gold is : " + gold); Console.WriteLine("Inesrt your time(In Hours) played: "); float hours = float.Parse(Console.ReadLine()); int minutes = 60; float time = (float)hours * minutes; // Here the calculation are wrong... Console.WriteLine("Your total time playd is : " + time + " minutes"); float goldMin = gold / time; Console.WriteLine("Your gold per minute is : " + goldMin); Console.WriteLine("The application has ended, press any key to end this app. \nThank you for using it."); Console.ReadLine(); } } } </code></pre> <p>Thank you!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload