I really need help with this so if anyone can help me out that wouldbe really great of you.

P

Patricia Shanahan

Mark said:
*whoosh*

And the point goes flying over your head, I'm sorry to have to say.
....

I hope, and believe from the rest of the thread, that the "it worked"
referred to my suggestion of enclosing Java String literals in quotes,
not Stefan's demonstration of how to make a simple job difficult.

Patricia
 
G

GArlington

I am a student studying in college this is my first year and i am
taking Computer Science as my Major but i am having a hard time with
my course.

Why did you decide to take "Computer Science as your Major"?
Are you familiar with maths and logic?
Computer Science is primarily about making any task as simple as
possible - average computer is far less clever than the average human.
I have no idea of whats going on in class so if any 1 knows
anything about this things i have to do please help me out.

the professor gave us this to do and i am having some trouble with
this so plz help me out on what to do here.

Part I

Write a program that prints the following pattern:

*
***
*****
*******
*****
***
*

So, when you are facing a problem you should always simplify and
generalise it:
1) what is the above figure?
2) are there any patterns that you can see in this figure?
The number (and position) of the *s in the above figure seems to be
increasing and then reducing at the same rate per step (line) from the
minimum (1) to the maximum (7) and then back to minimum (1).
So, what can you do? Make a program so the computer will create this
pattern for you depending on the minimum, maximum and step parameters.

You can apply the same principal - simplify and generalise - to your
next task.
Once you understand and use this approach you will be half way to
becoming a programmer and to your "Computer Science Major"...
 
W

Wildemar Wildenburger

Gordon said:
There is a long standing Usenet tradition of providing technically
correct but obfuscated, advanced or otherwise "unlikely" solutions to
homework questions.

It's something the OP needs to deal with, and is IMO an important part
of the learning process if he comes here with questions that show a
complete lack of effort to solve the problem himself.
That's the sort of out-of-touch argumentation that usually arises when
people forget how they felt when they started out. I don't think there
is an excuse for misleading (and in a way, mocking) the ignorant. Ever.
At least a little "grain of salt"-notice. I also don't object to the
idea of letting someone discover certain pitfalls by actually stepping
into them and experience the result; it is the intentional prodding and
ommission of warnings that bothers me.

/W
 
L

Lew

Please do not use textspeak in Usenet posts.

A couple of points about your assignment that you will need to know if you
ever use Java outside of school:

- by long-standing and nearly rigid convention, Java variables are spelled
without underscores and with mixed case, capitalizing each word part except
the first, hence "percentMarkedUp".

- doubles work fine as currency values for academic work, but not so much in
the real world. The issues are somewhat complex, so we stick with doubles
until we've learned some more of the basics.

Let's review your assignment piece by piece:

I'll give you this part. A "Java program" is a class with a properly-defined
main() method.

package programming.oneohone;
public class RetailModel
{
public void main( String [] args )
{
}
}

There are two places you could declare variables so far, within the class
itself as instance or class variables, or within the main() method. The
main() method is simpler, so start there.

Do you know how to declare variables? I'll give you one, focusing in on just
the main() method and not the rest of the class.

public void main( String [] args )
{
double percent_markedup;
}

It's the same for the others.

Well, the declaration of 1. that I showed you doesn't assign a value, because
it doesn't have an initialization clause.

Yet.

The tutorial gives a hint near the top of the page about initialization, in
case you forget the course information:
<http://java.sun.com/docs/books/tutorial/java/nutsandbolts/variables.html>

So go ahead and modify the declarations you just wrote and add the
initializations.

Solve one itty-bitty problem at a time, and make sure your program is correct
at each stage. Only then add in the next piece of the puzzle, one itty-bitty
problem at a time.

This is beginning to sound a lot like Patricia Shanahan's advice, isn't it?
You should go back to her link and read it again, very carefully.

Quiz: Where (in what file) do you store the source code for your RetailModel
program?

General advice: Read the rest of the tutorial, not just the one page I linked
you to.
 
S

Stefan Ram

GArlington said:
The number (and position) of the *s in the above figure seems to be
increasing and then reducing at the same rate per step (line) from the
minimum (1) to the maximum (7) and then back to minimum (1).

And every line starts with a »TAB« character:

telnet news 119 | od -c
article <ca2a9ab2-4bcf-4973-aeca-75fd4df76f80@s12g2000prg.googlegroups.com>
(...)
0003400 w i n g p a t t e r n : \n \n \t
0003420 * \n \t * *
0003440 * \n \t * * * * * \n
0003560 * * * * * * * \n
0003500 \t * * * * * \n \t
0003520 * * * \n \t * \n \n
0003540 P a r t I I \n \n T o m a k e
(...)
quit

The rendition of a TAB character depends on the output device.

Sometimes a TAB is converted to eight or another number of
spaces. Sometimes it is not a fixed value of spaces but a jump
to a specific position.

Therefore, any program trying to reproduce it, should
faithfully start each line with a TAB character.

That is, if one reads »the following pattern« in a sense
including the indentation.
 
A

adityagaddam90

Please do not use textspeak in Usenet posts.

A couple of points about your assignment that you will need to know if you
ever use Java outside of school:

- by long-standing and nearly rigid convention, Java variables are spelled
without underscores and with mixed case, capitalizing each word part except
the first, hence "percentMarkedUp".

- doubles work fine as currency values for academic work, but not so much in
the real world. The issues are somewhat complex, so we stick with doubles
until we've learned some more of the basics.

Let's review your assignment piece by piece:

I'll give you this part. A "Java program" is a class with a properly-defined
main() method.

package programming.oneohone;
public class RetailModel
{
public void main( String [] args )
{
}

}
There are two places you could declare variables so far, within the class
itself as instance or class variables, or within the main() method. The
main() method is simpler, so start there.

Do you know how to declare variables? I'll give you one, focusing in on just
the main() method and not the rest of the class.

public void main( String [] args )
{
double percent_markedup;
}

It's the same for the others.

Well, the declaration of 1. that I showed you doesn't assign a value, because
it doesn't have an initialization clause.

Yet.

The tutorial gives a hint near the top of the page about initialization, in
case you forget the course information:
<http://java.sun.com/docs/books/tutorial/java/nutsandbolts/variables.html>

So go ahead and modify the declarations you just wrote and add the
initializations.

Solve one itty-bitty problem at a time, and make sure your program is correct
at each stage. Only then add in the next piece of the puzzle, one itty-bitty
problem at a time.

This is beginning to sound a lot like Patricia Shanahan's advice, isn't it?
You should go back to her link and read it again, very carefully.

Quiz: Where (in what file) do you store the source code for your RetailModel
program?

General advice: Read the rest of the tutorial, not just the one page I linked
you to.

hey Lew thank you soo soo much that instruction by instruction really
helped me a lot and thank you so much again.
 
L

Lew

Stefan said:
And every line starts with a »TAB« character:

telnet news 119 | od -c
article <ca2a9ab2-4bcf-4973-aeca-75fd4df76f80@s12g2000prg.googlegroups.com>
(...)
0003400 w i n g p a t t e r n : \n \n \t
0003420 * \n \t * *
0003440 * \n \t * * * * * \n
0003560 * * * * * * * \n
0003500 \t * * * * * \n \t
0003520 * * * \n \t * \n \n
0003540 P a r t I I \n \n T o m a k e
(...)
quit

The rendition of a TAB character depends on the output device.

Sometimes a TAB is converted to eight or another number of
spaces. Sometimes it is not a fixed value of spaces but a jump
to a specific position.

Therefore, any program trying to reproduce it, should
faithfully start each line with a TAB character.

That is, if one reads »the following pattern« in a sense
including the indentation.

You took "TAB at the beginning" as a requirement because of an accident of how
the message was posted to Usenet? How can you be sure that the TAB was part
of the original specification and not an artifact introduced by the OP?
 
A

Andreas Leitgeb

Lew said:
You took "TAB at the beginning" as a requirement because of an accident of how
the message was posted to Usenet? How can you be sure that the TAB was part
of the original specification and not an artifact introduced by the OP?

One might tend to speculate that the OP spent no more effort than a direct
copy&paste of the outset...
 
L

Lew

Andreas said:
One might tend to speculate that the OP spent no more effort than a direct
copy&paste of the outset...

Key word being "speculate". While we're speculating, let's speculate that the
professor only meant the TAB as white space and not part of the requirement as
such. Given the age and prevalence of this particular exercise, it might even
have been handed out on paper, so the OP's "copy and paste" would have been a
rather laborious process. Quite natural to hit the TAB key as a shortcut in
those circumstances.

Unless the assignment explicitly states, in words, that TABs are a
requirement, it's quite the huge leap to make them into one based on a hex
dump of a Usenet post.

One might speculate...
 
A

Andreas Leitgeb

Lew said:
Key word being "speculate".

This whole thread is probably based on speculation,
like that one's homework might be easier if the net did it :)
Given the age and prevalence of this particular exercise, it might even
have been handed out on paper,...

Don't think so, because merely typing the outset from a paper would have
been more effort than just doing the homework.
Unless the assignment explicitly states, in words, that TABs are a
requirement, it's quite the huge leap to make them into one based on a hex
dump of a Usenet post.

It's not a proof, but let's see if it nudges the scales sufficiently to
persuade the jury not to condemn these poor tab characters, that are yet
at the very beginning of their lines. :)
 
A

Arne Vajhøj

Gordon said:
There is a long standing Usenet tradition of providing technically
correct but obfuscated, advanced or otherwise "unlikely" solutions to
homework questions.

It's something the OP needs to deal with, and is IMO an important part
of the learning process if he comes here with questions that show a
complete lack of effort to solve the problem himself.

It is surprising that I have not stopped being amazed over peoples
lack of character.

Tradition is a very bad excuse for doing wrong.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top