Advertisement
mehedi2022

A recipe for your favourite dish_ other way

Sep 10th, 2022 (edited)
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 2.37 KB | None | 0 0
  1. // cooking recipe for beef steak
  2. println("Beef steak recipe :")
  3. println("Wash and soak the beef.")
  4. println("Add salt and peeper.")
  5. println("Place the beef in oven, set temperature and time.")
  6. println("Take out from oven & serve")
  7.  
  8. //cooking recipe for beef steak (Method way)
  9. def favRecipe =
  10.   println("Beef steak recipe :")
  11.   println("Wash and soak the beef.")
  12.   println("Add salt and peeper.")
  13.   println("Place the beef in oven, set temperature and time.")
  14.   println("Take out from oven & serve")
  15.  
  16. favRecipe
  17.  
  18. // cooking recipe for beef steak (Method & parameter)
  19. def favRecipe (temp: Int, time:Int, s: String, s2: String, s3:String, s4:String) =
  20.  {
  21.   var temp= 350    // for Rare/medium Rare/well cooked steak it may change that's why its var
  22.   var time= 6.0      //for Rare/medium Rare/well cooked steak it may change that's why its var
  23.   var s1= "Beef steak (well cooked) recipe :"
  24.   val s2= "Wash and soak the beef."
  25.   val s3= "Add salt and pepper."
  26.   val s4= "Place the beef in oven, set at "
  27.   val s5= "Take out from oven & serve."
  28.   val result = (s1 + s2 + s3 + s4 + s" $temp deg F and $time mins." + s5)
  29.   println(result)
  30.  
  31.   temp= 400
  32.   time= 4.0
  33.   s1= "Beef steak (Medium Rare) recipe :"
  34.   val(result2) = (s1 + s2 + s3 + s4 + s" $temp deg F and $time mins." + s5)
  35.   println(result2)
  36.  
  37.   time= 2.5
  38.   s1= "Beef steak (Rare Cooked) recipe :"
  39.   val(result3) = (s1 + s2 + s3 + s4 + s" $temp deg F and $time mins." + s5)
  40.   println(result3)
  41. }
  42. favRecipe
  43.  
  44.  
  45. // cooking recipe for beef steak
  46. def favRecipe:Unit = (args: Array[String])
  47. {
  48.   var temp= 350    // for Rare/medium Rare/well cooked steak it may change that's why its var
  49.   var time= 6.0      //for Rare/medium Rare/well cooked steak it may change that's why its var
  50.   var s1= "Beef steak (well cooked) recipe : "
  51.   val s2= " Wash and soak the beef."
  52.   val s3= " Add salt and pepper."
  53.   val s4= " Place the beef in oven, set at "
  54.   val s5= " Take out from oven & serve."
  55.   val result = (s1 + s2 + s3 + s4 + s" $temp deg F and $time mins." + s5)
  56.   println(result)
  57.  
  58.   temp= 400
  59.   time= 4.0
  60.   s1= "Beef steak (Medium Rare) recipe : "
  61.   val(result2) = (s1 + s2 + s3 + s4 + s" $temp deg F and $time mins." + s5)
  62.   println(result2)
  63.  
  64.   time= 2.5
  65.   s1= "Beef steak (Rare Cooked) recipe : "
  66.   val(result3) = (s1 + s2 + s3 + s4 + s" $temp deg F and $time mins." + s5)
  67.   println(result3)
  68. }
  69.  
  70. favRecipe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement