Advertisement
Guest User

perl6-class

a guest
Jun 1st, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.40 KB | None | 0 0
  1. #!/usr/bin/perl6
  2.  
  3. use v6;
  4.  
  5.  
  6. class TemperatureConversion {
  7.     has $.total is rw;
  8.     has $.cel is rw;
  9.     has $.fah is rw;
  10.     has $.kel is rw;
  11.     has $.ran is rw;
  12.  
  13.     method CelToFah {
  14.         say "Celcius to Fahrenheit";
  15.         $.cel = prompt "Insert value: ";
  16.  
  17.         $.total = $.cel * 9/5 + 32;
  18.  
  19.         printf "Total temperature is: %.2f\n", $.total
  20.     }
  21. }
  22.  
  23. my $test = TemperatureConversion.new();
  24. $test.CelToFah();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement