Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class Voto {
  4. private double [] Voti;
  5. private String [] Materia;
  6. private int count;
  7.  
  8. public Voto(){
  9. Voti=new double [10];
  10. Materia=new String[10];
  11. count=0;
  12. }
  13.  
  14.  
  15. public String Visual(){
  16. String s=" ";
  17. if(count==0){
  18. s="0 voti";
  19. } else {
  20. for(int i=0; i <count; i++){
  21. s += Voti[i] + " " + Materia[i] + ";" + " " ;
  22. }
  23. }
  24. return s;
  25. }
  26.  
  27. public boolean Add (double v, String m){
  28. if(v<1 || v>10 || v==0){
  29. return false;
  30. }
  31. else{
  32. Voti[count]=v;
  33. Materia[count]=m;
  34. count++;
  35. return true;
  36. }
  37. }
  38.  
  39. public int count(){
  40. return count;
  41. }
  42.  
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement