Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class Voti {
  4. private double[] _Voti;
  5. private int _count;
  6. private String[] Materia;
  7.  
  8.  
  9. public Voti() {
  10. _Voti = new double[10];
  11. Materia = new String[10];
  12.  
  13. _count = 0;
  14.  
  15.  
  16. }
  17.  
  18.  
  19. public boolean Inseriento(String c, double v) {
  20. if (v < 0 || v > 10) { //*LIMITI
  21. return false;
  22. } else {
  23. Materia[_count] = c;
  24. _Voti[_count] = v;
  25. _count++;
  26. return true;
  27.  
  28. }
  29.  
  30. }
  31.  
  32.  
  33.  
  34. public String MostraVoti() {
  35. String s = "";
  36.  
  37. if (_count == 0) {
  38. s = "non ci sono valutazioni";
  39. }
  40. else {
  41.  
  42. for (int i = 0; i < _count; i++) {
  43. s = _Voti[i] + " " + Materia[i];
  44. }
  45. }
  46. return s;
  47.  
  48.  
  49. }
  50. public int count(){
  51. return _count ;
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement