Overview
The purpose of this project was to develop a functional time converter using C# programming. To implement my code, I utilized JDoodle as an online development environment, which allowed me to test and refine my program efficiently. Throughout the process, I focused on writing clean, accurate code to ensure the converter operated correctly. Additionally, I incorporated peer review to receive feedback, which helped me improve both the functionality and overall quality of my program.
Details
The two data types that were used in my code are Double and String:
Double:
This data type was used for storing fractional and whole numbers with decimal precision.
The double data type represents a double-precision floating-point number, which is a number that can have decimal points.
In the code, the double was used to allow the starting number of days (numberOfDays) and the calculated values (hours, minutes, seconds) to include fractional amounts such as 3.5 days.
This data type is suitable when you need to represent numbers with decimals and require good precision.
String:
This data type is implicitly used in the Console.Writeline method when printing text and variable values, but those are not explicitly declared in the code.
Ultimately, the string data type was used implicitly in the Console.Writeline statements for displaying text combined with numbers.
Algorithm:
Start
Define a variable to store the number of days (can be a fractional number).
Calculate the total hours by multiplying the number of days by 24.
Calculate the total minutes by multiplying the total hours by 60.
Calculate the total seconds by multiplying the total minutes by 60.
Print the original number of days and its equivalent hours, minutes, and seconds.
End
Takeaways
Reflecting on this project, I gained valuable insight into how coding can be applied to create practical, real-world solutions. Developing something as useful as a time converter allowed me to see the direct impact of my work beyond the classroom. Throughout the process, I grew more confident in my coding abilities and developed a deeper appreciation for iteration—understanding that refining and improving my code is an essential part of producing an effective final product.
Navigate