d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > 100 Fg And You Do Me This Assignment
Add Reply New Topic New Poll
Member
Posts: 10,049
Joined: Aug 11 2014
Gold: 540.00
Oct 13 2015 07:36pm
100, thats all I have

need to be done before tomorrow night

pm me if bin


https://drive.google.com/file/d/0B_LfHGeZJ0EUOEY1OVp6QWg3ZjA/view?usp=sharing
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 13 2015 07:45pm
i need a ferrari. i've only got 73.10 fg. needs to be in my garage tomorrow night.

Quote
The purpose of this assignment is to help you learn the Java selection and flow of control statements, if, if/else, while and do/while loops - can use for loops but not required.
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Oct 13 2015 09:27pm
:rofl:
Member
Posts: 2,757
Joined: Nov 26 2007
Gold: 1,214.81
Oct 14 2015 09:49am
I wrote this real quick so you can use as a guide. I'd suggest re-writing it completely so you understand what everything does. Also, there's no validation, which is required in ur assignment, so try to add that. If you need help with that, let me know.

Code
import java.util.Scanner;

public class House {
public static void main( String[] args ) {

int count = 0;
Scanner scanner = new Scanner( System.in );
System.out.println( "What is your name?" );
String name = scanner.nextLine( );

while ( true ) {
System.out.println( "Well " + name
+ ", welcome to my silly house drawing program." );

System.out.println( "Do you want me to draw a simple house for you? (yes/no)" );
boolean drawSimpleHouse = scanner.nextLine( ).equalsIgnoreCase( "yes" ) ? true
: false;

if ( !drawSimpleHouse ) {
break;
}

System.out.println( "Enter height and width of the house you want me to draw (must be even numbers):" );
String[] dimensions = scanner.nextLine( ).split( " " );

int height = Integer.parseInt( dimensions[0] );
int width = Integer.parseInt( dimensions[1] );

int middle = width % 2 == 0 ? (width / 2) - 1 : width / 2;
int heightRoof = middle + 1;

for ( int i = 0; i < heightRoof; i++ ) {
for ( int j = middle - i - 1; j >= 0; j-- ) {
System.out.print( " " );
}
if ( i == 0 ) {
System.out.print( "**" );
System.out.println( );
continue;
} else {
System.out.print( "/" );
for ( int k = 0; k < 2 * i; k++ ) {
System.out.print( " " );
}
}
System.out.print( "\\" );
System.out.println( );
}

for ( int i = 0; i < width; i++ ) {
System.out.print( "-" );
}

for ( int i = 0; i < height; i++ ) {
System.out.println( );
System.out.print( "|" );
for ( int j = 0; j < width - 2; j++ ) {
System.out.print( " " );
}
System.out.print( "|" );
}
System.out.println( "" );
for ( int i = 0; i < width; i++ ) {
System.out.print( "-" );
}

count++;
System.out.println( "\n" + name
+ " do you want me to draw another house for you (yes to continue)?" );
if ( !scanner.nextLine( ).equalsIgnoreCase( "yes" ) ) {

System.out.println( "Hope you like your "
+ (count > 1 ? count + " houses" : "house") + "!\nCome back soon "
+ name + "..." );

break;
}
}

}
}


This post was edited by labatymo on Oct 14 2015 09:57am
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Oct 14 2015 05:58pm
I have emailed the faculty members who teach COMP 248 at Concordia University a copy of the code submitted here, as well as a link to this thread. This surely violates their honor code. Good luck.
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Oct 15 2015 08:15am
Quote (Minkomonster @ Oct 14 2015 03:58pm)
I have emailed the faculty members who teach COMP 248 at Concordia University a copy of the code submitted here, as well as a link to this thread. This surely violates their honor code. Good luck.


rekt
Member
Posts: 11,643
Joined: Dec 18 2006
Gold: 340.00
Oct 15 2015 11:35am
Quote (Minkomonster @ Oct 14 2015 06:58pm)
I have emailed the faculty members who teach COMP 248 at Concordia University a copy of the code submitted here, as well as a link to this thread. This surely violates their honor code. Good luck.


Winner! B)
Member
Posts: 21,211
Joined: May 22 2009
Gold: 9,036.90
Oct 15 2015 07:16pm
Quote (Minkomonster @ Oct 14 2015 06:58pm)
I have emailed the faculty members who teach COMP 248 at Concordia University a copy of the code submitted here, as well as a link to this thread. This surely violates their honor code. Good luck.


heh, I actually attend this university. Was sort of shocked what are the chances that it's my university this assignment is for O.o Good job! Screw the cheaters
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll