Posts by Bruno • 383 points
25 posts
-
1
votes1
answer40
viewsQ: Creating matrix with the Scanner class
I’m trying to fill a 5x5 matrix but when I run the ORDER in the finish entry, the code returns me the matrix filled with the word END. public static void main(String[] args) { Scanner sc = new…
-
-3
votes1
answer103
viewsQ: Accessing List of another class
I have a Warehousing class that contains a list of products, as would the interaction of this list in the managed class using the returned methodProduct() without parameters. On the output of my…
-
-2
votes1
answer126
viewsQ: Sum line in matrix
I implemented this code to sum line by row of the matrix and tell which row has the highest sum, but the output is blank, in which case the sum would be line 1 (1+1+1+1) line 2 (0+1+0+1) and so on.…
-
1
votes1
answer50
viewsQ: Using another class Return
Good morning friends, I’m trying to implement this code but it’s giving error. public int totalFaltasAluno(int matricula) { int totalFaltas = 0; for(Integer item : faltas){ if(item == matricula){…
-
0
votes1
answer243
viewsQ: Calculating Number Frequency in an Arraylist
I would like a help to calculate the frequency that enrollments (whole numbers) of students appear to be able to count the total number of absences in the day. public class Principal { public static…
-
-1
votes2
answers120
viewsQ: Manipulation of Arraylist
Good morning Friends, I am having a lot of difficulties in making this application work, I am not able to calculate the days of absence of the students, my difficulty is in the class Agenda in the…
-
0
votes1
answer104
viewsQ: Count integer occurrence in an Arraylist
Good afternoon, I’m having a lot of trouble calculating the total number of student absences, I’m not able to implement this class somafalta, I would like a help. from now on. import…
-
4
votes2
answers296
viewsQ: Inserting data into an Arraylist
I have a problem to implement this code, I can not enter the data in Arraylist. public class Principal { public static void main(String[] args) { Faltas faltas = new Faltas();…
-
1
votes2
answers94
viewsQ: Incorrect Output when Printing Array Elements
public class Principal { public static void main(String[] args) { Turma turma = new Turma("Est. de dados","A1","20191"); turma.inserirAluno(new Aluno("Anselmo",111)); turma.inserirAluno(new…
-
2
votes1
answer34
viewsA: how to raise project requirements
These questions depended on which project will be implemented, taking as an example an implementation for a restaurant, we have : how many employees have, will be made reservation of tables, what…
software-engineeringanswered Bruno 383 -
3
votes1
answer94
viewsQ: Static reference giving error while accessing
My code is giving a static reference error, what that information means? public class inicio { public static void main(String[] args) { System.out.println(soma(2,2)); } public int soma(int n,int m){…
-
0
votes1
answer51
viewsA: Implementing get method
After some research I managed to solve. implemented a cast within the get method in the Video class. public long getDuracao() { long tempoDuracao = 0; if(visualizacoes < 1000) { tempoDuracao =…
-
0
votes1
answer51
viewsQ: Implementing get method
I need to adjust the video time according to some rules, as I do to implement these rules in the code, I tried to put in the get method but no change. public class Principal { public static String…
-
0
votes1
answer236
viewsQ: Add objects of different types in the same vector
I can’t add class Video within the vector. public class SongDriver { public static void main(String[] args) { Playlist lista = new Playlist(); Musica num1 =new Musica("Agua de beber","Antonio Carlos…
-
1
votes1
answer137
viewsQ: python content management
try: with open('valores.bin', 'r+b') as arq: n = struct.unpack('i', arq.read(4))[0] arq.seek(0) for i in range(n): arq.seek(0) if isinstance(struct.unpack('i', arq.read(4)), int) and…
python-3.xasked Bruno 383 -
0
votes1
answer278
viewsQ: Transfer list to Python binary file
Good morning programmers. Need to put a list in a binary file but is showing error. lista = [-1, 333.0, -1, 333.0, 10, 8.0, 45, -66.5999984741211, 12, -44.70000076293945] Code: open("saida.bin",…
python-3.xasked Bruno 383 -
1
votes1
answer3978
viewsQ: Substituting values in a list
I need to replace values in a list of agreements with some criteria. Criteria: if the value is an integer and less than the reported value is replaced by -1 if the value is a floating point number…
-
4
votes2
answers1611
viewsQ: Word count using dictionary
I need to count the occurrences of words in a text using as reference a list of predetermined words. I turned the text into a list of string, the words are in a set (set) palavras_procuradas =…
-
2
votes1
answer97
viewsQ: print text without translineation rule
I need to print a text from a file on a single line without the line break traces. def imprime_texto(): with open("texto.txt") as arquivo: linhas = arquivo.read().split("\n") for linha in linhas:…
-
0
votes1
answer799
viewsQ: Replace in list
I need some help with the code. def corrigePalavra(str): palavra = [str[-1:], str[-2:], str[-3:], str[-4:]] result = str palavra_modificada = False for w in palavra: if result.count(w) > 1:…
-
0
votes2
answers214
viewsQ: Count trading amounts performed with python replace
I need a code help, I need to count how many changes were made in the sentence, you have some idea to pass me.this code is to remove repeat substrings that are at the end of the sentence, now I need…
-
0
votes1
answer305
viewsQ: Search for sub-strings Python 3.xx
How to find Substring Occurrences in a string in Python. I need to do in hand this is my difficulty, I have to go through the string and if I find two occurrences of substring equal I have to remove…
-
0
votes2
answers776
viewsQ: Compare values in a list of tuples
lista = [('Maria', 28, 7.0), ('Ana', 30, 9.0), ('Thiago', 30, 9.0)] resultado = [] for i in lista: if i[2]<i[2]+1: resultado.append(i[0]) print(resultado) Correct exit: Ana, Thiago, Maria My way…
-
2
votes1
answer812
viewsQ: Comparison of values in python Tuples list 3.x
My doubt is how I can interact on this list to make comparisons between values. def trocar(vals, posX, posY): temp = vals[posX] vals[posX] = vals[posY] vals[posY] = temp return None def…
-
0
votes3
answers3361
viewsA: Make list with input in python
Using the function that Jorge posted you can go through the dictionary by obtaining the values of the keys and calculating the weighted average. medias = [] candidatos = 2 pesos=…