[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

How does my Java code look? it checks an image made up of zero

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 13
Thread images: 2

File: 1451980977771.png (212KB, 500x500px) Image search: [Google]
1451980977771.png
212KB, 500x500px
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
>>
>>56957880
>>>/g/rules/3
>>
>>56957880
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")
>>
Is this the new cringe thread
>>
how nu r u
>>
A+ thread, will read again.
>>
>>56958422
shit code
>>
File: what.png (9KB, 998x152px) Image search: [Google]
what.png
9KB, 998x152px
>>56957910
HIRO FIX NOW
Thread posts: 13
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.