School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,035 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,269 people online right now. Registration is fast and FREE... Join Now!




asterik checkerboard pattern

 

asterik checkerboard pattern

MelodyEN02

23 Oct, 2009 - 12:13 PM
Post #1

New D.I.C Head
*

Joined: 20 Oct, 2009
Posts: 9

I know that I have already posted this elsewhere, but I was hoping that this would get a few more people looking at it.

My teacher has given us an assignment and wants us to finish filling out his coding. I originally had figured out how to make a checkerboard with different coding but he didn't accept it. So that you can help get me going in the write direction I'm going to cut and paste the assignment and then my failed attempt at solving it. I'm not going to post what I actually got to work, but was unacceptable to the teacher as it will not help.


Any advise would be appreciated. Thanks for looking at it.

His code:

CODE

1 <?xml version = "1.0" encoding = "utf-8"?>

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

4

5

<!-- Exercise 7.25 Solution -->

6 <html xmlns = "http://www.w3.org/1999/xhtml">

7 <head>

8 <title>Solution 7.25</title>

9 <script type = "text/javascript">

10 <!--

11 var side = 8;

12 var row;

13

14 document.writeln( );

15

16 while( )

17 {

18 row = 8;

19

20 if( )

21    document.write( );

22

23 while( )

24 {

25

26     document.write( );

27      row -= 1;

28 } // end while

29

30    document.writeln( );

31     side -= 1;

32 } // end while

33

34 document.writeln( );

35 // -->

36 </script>

37 </head>

38 <body>

39 <p>Click Refresh (or Reload) to run this script again.</p>

40 </body>

41 </html>


My revised code:

CODE

<?xml version = "1.0" encoding = "utf-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html xmlns = "http://www.w3.org/1999/xhtml">

<head>

<title>Solution 7.25</title>

<script type = "text/javascript">

<!--
var side = 8;
var row;
document.writeln( "<pre>" );
while( side % 2 != 0 )
{
row = 8;
if( row >= 1 )
   document.write( " " );
while( side >= 1 )
{
    document.write( "* " );
     row -= 1;
} // end while
   document.writeln( );
    side -= 1;
} // end while
document.writeln( "</pre>" );
// -->
</script>
</head>


User is offlineProfile CardPM
+Quote Post


MelodyEN02

RE: Asterik Checkerboard Pattern

23 Oct, 2009 - 05:58 PM
Post #2

New D.I.C Head
*

Joined: 20 Oct, 2009
Posts: 9

Is anyone at all able to help me, or even get me pointed in the right direction?

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 08:43AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month