Guest User

Untitled

a guest
Mar 13th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. package com.example.android.justjava
  2.  
  3.  
  4. import android.os.Bundle
  5. import android.support.v7.app.AppCompatActivity
  6. import android.view.View
  7. import android.widget.TextView
  8. import java.text.NumberFormat
  9.  
  10. class MainActivity : AppCompatActivity() {
  11.  
  12. override fun onCreate(savedInstanceState: Bundle?) {
  13. super.onCreate(savedInstanceState)
  14. setContentView(R.layout.activity_main)
  15. }
  16.  
  17. fun submitOrder(view: View) {
  18. int numberOfCoffees 2
  19. display(numberOfCoffees)
  20. displayPrice(numberOfCoffees * 5)
  21. }
  22.  
  23.  
  24. fun display(number: Int) {
  25. val quantityTextView = findViewById<View>(R.id.quantity_text_view) as TextView
  26. quantityTextView.text = ("" + number)
  27. }
  28.  
  29.  
  30. private fun displayPrice(number: Int) {
  31. val priceTextView = findViewById<View>(R.id.price_text_view) as TextView
  32. priceTextView.setText(NumberFormat.getCurrencyInstance().format(number))
  33. }
  34. }
  35. Выдаёт ошибки
  36. Error:(32, 9) Unresolved reference: int
  37. Error:(33, 17) Unresolved reference: numberOfCoffees
  38. Error:(34, 22) Unresolved reference: numberOfCoffees
  39. Error:Execution failed for task ':app:compileDebugKotlin'.
  40. > Compilation error. See log for more details
  41. Information:BUILD FAILED in 1s
  42. Information:4 errors
  43. Information:0 warnings
  44. Information:See complete output in console
  45. Вот в этом тексте, не знаю как задать переменную правильно.
  46. "fun submitOrder(view: View) {
  47. int numberOfCoffees 2
  48. display(numberOfCoffees)
  49. displayPrice(numberOfCoffees * 5)"
Add Comment
Please, Sign In to add comment