How does my Java code look? it checks an image made up of zero and ones for mistakes you using parity bits. mostly just check for syntax stuff and make sure it all makes sense. Still learning java.
import java.io.*;
import java.util.*;
public class project4{
public static void main(String[] args) throws IOException {
count1 = 0;
count2 = 0;
//gets file
Scanner s = new Scanner(System.in);
System.out.print("Input a filename:");
String filename = s.nextLine();
File inputFile = new File(filename);
Scanner inFile = new Scanner(inputFile)
//gets dimmensions
StringTokenizer st = new StringTokenizer(inFile.Nextline, "x");
int maxcolumns = Integer.parseInt(st[0]);
int maxrows = Integer.parseInt(st[1]);
int[][] picture = new int[maxrows][maxcolumns];
inFile.nextLine =
//gets picture
for (int i = 0; i < maxrows; i++) {
String line = infile.nextLine();
String[] rows = line.substring(i);
for (int j = 0; j < maxcolumns; j++ )
picture[i][j] = Integer.parseInt(rows[j])
}
}
for(int i = 0; i < maxrows; i++){
count==0;
for(int j = 0; j<maxcolumns;i++){
count == count + picture[i][j];
}
if (count % 2 = 1){
Badrow = i;
}
}
for(int i = 0; i < maxcolumns; i++){
count==0;
for(int j = 0; j<maxcolumns;i++){
count == count + picture[i][j];
}
if (count % 2 = 1){
Badcolumn = j;
}
}
if (picture[badrow][badcolumn] == 0){
picture[badrow][badcolumn] == 1;
}
else (){
picture[badrow][badcolumn] = 0
}
if (count % 2 = 1){
System.out.print("Position" (badrow, badcolumn) "was modified... correcting");
System.out.print("");
}
System.out.print(picture[i][j]);
else if (count % 2 = 0){
System.out.print("No errors")
System.out.print("")
System.out.print(picture[i][j])
}
else
System.out.print("errors")
>No code tags
I'm not reading that shit.
inb4 you post it again with code tags but no proper indentation.
>>56957805
We have code tags for a reason, mother fucker.
>>56957805
kill yourself
>>56957823
code tags? I have notes if that what you mean. I will repost it though
import java.io.*;
import java.util.*;
public class project4{
public static void main(String[] args) throws IOException {
count1 = 0;
count2 = 0;
//gets file
Scanner s = new Scanner(System.in);
System.out.print("Input a filename:");
String filename = s.nextLine();
File inputFile = new File(filename);
Scanner inFile = new Scanner(inputFile)
//gets dimmensions
StringTokenizer st = new StringTokenizer(inFile.Nextline, "x");
int maxcolumns = Integer.parseInt(st[0]);
int maxrows = Integer.parseInt(st[1]);
int[][] picture = new int[maxrows][maxcolumns];
inFile.nextLine =
//gets picture
for (int i = 0; i < maxrows; i++) {
String line = infile.nextLine();
String[] rows = line.substring(i);
for (int j = 0; j < maxcolumns; j++ )
picture[i][j] = Integer.parseInt(rows[j])
}
}
for(int i = 0; i < maxrows; i++){
count==0;
for(int j = 0; j<maxcolumns;i++){
count == count + picture[i][j];
}
if (count % 2 = 1){
Badrow = i;
}
}
for(int i = 0; i < maxcolumns; i++){
count==0;
for(int j = 0; j<maxcolumns;i++){
count == count + picture[i][j];
}
if (count % 2 = 1){
Badcolumn = j;
}
}
if (picture[badrow][badcolumn] == 0){
picture[badrow][badcolumn] == 1;
}
else (){
picture[badrow][badcolumn] = 0
}
if (count % 2 = 1){
System.out.print("Position" (badrow, badcolumn) "was modified... correcting");
System.out.print("");
}
System.out.print(picture[i][j]);
else if (count % 2 = 0){
System.out.print("No errors")
System.out.print("")
System.out.print(picture[i][j])
}
else
System.out.print("errors")
>>56957880
not sure how to indent i guess... it changes it
>>56957880import java.io.*;
import java.util.*;
public class project4{
public static void main(String[] args) throws IOException {
count1 = 0;
count2 = 0;
//gets file
Scanner s = new Scanner(System.in);
System.out.print("Input a filename:");
String filename = s.nextLine();
File inputFile = new File(filename);
Scanner inFile = new Scanner(inputFile)
//gets dimmensions
StringTokenizer st = new StringTokenizer(inFile.Nextline, "x");
int maxcolumns = Integer.parseInt(st[0]);
int maxrows = Integer.parseInt(st[1]);
int[][] picture = new int[maxrows][maxcolumns];
inFile.nextLine =
//gets picture
for (int i = 0; i < maxrows; i++) {
String line = infile.nextLine();
String[] rows = line.substring(i);
for (int j = 0; j < maxcolumns; j++ )
picture[i][j] = Integer.parseInt(rows[j])
}
}
for(int i = 0; i < maxrows; i++){
count==0;
for(int j = 0; j<maxcolumns;i++){
count == count + picture[i][j];
}
if (count % 2 = 1){
Badrow = i;
}
}
for(int i = 0; i < maxcolumns; i++){
count==0;
for(int j = 0; j<maxcolumns;i++){
count == count + picture[i][j];
}
if (count % 2 = 1){
Badcolumn = j;
}
}
if (picture[badrow][badcolumn] == 0){
picture[badrow][badcolumn] == 1;
}
else (){
picture[badrow][badcolumn] = 0
}
if (count % 2 = 1){
System.out.print("Position" (badrow, badcolumn) "was modified... correcting");
System.out.print("");
}
System.out.print(picture[i][j]);
else if (count % 2 = 0){
System.out.print("No errors")
System.out.print("")
System.out.print(picture[i][j])
}
else
System.out.print("errors")
Is this the new cringe thread
how nu r u
A+ thread, will read again.
>>56958422
shit code
>>56957910
HIRO FIX NOW