Pure Programmer
Blue Matrix


Cluster Map

Project: Dog Years

It is said that dogs age in one year the equivalent of seven years of human grown. A puppy of one year is the same as a human of seven years. A dog of two years of age is equivalent to a human teenager of 14. Write a program that uses integer constants and variables to compute the equivalent ages of a dog of 1, 2, 5 and 10 years. Use * as the symbol for multiplication.

Output
$ rustc DogYears.rs warning: variable `dogYears` should have a snake case name --> DogYears.rs:10:10 | 10 | let mut dogYears:isize = 1; | ^^^^^^^^ help: convert the identifier to snake case: `dog_years` | = note: `#[warn(non_snake_case)]` on by default warning: variable `humanYears` should have a snake case name --> DogYears.rs:11:10 | 11 | let mut humanYears:isize = dogYears * HUMAN_YEARS_PER_DOG_YEAR; | ^^^^^^^^^^ help: convert the identifier to snake case: `human_years` warning: 2 warnings emitted $ ./DogYears 1 dog years = 7 human years 2 dog years = 14 human years 5 dog years = 35 human years 10 dog years = 70 human years

Solution