Simple Programming Problems

Posted on by
Simple Programming Problems

Whenever I’m TA for a introductory CS class where students learn some programming language, I have trouble coming up with good exercises. Problems from Project. C and C++ Programming Practice Problems Many of these problems will also make for excellent C++ job interview preparation. Fill in the blank exercises are designed.

If you have just started learning basics of Java programming language or familiar with programming in either C or C++ then these Java programming questions and exercises for you. It doesn't focus on particular part of Java but these coding exercises will switch you in programming mode.These are also great way to master basic programming construct like if-else, loops like for and while,, Java operators e.g. Arithmetic and logical operator,, methods or functions and common Java API. You may also find these Java programming questions in most of Java courses taught in school, colleges and various Java training courses. Even I have started learning Java by doing these exercises multiple times with different ways. They are interesting, gives feeling of accomplishment if you complete it. These Java programs looks simple but they are still tricky for novice Java programmers.

Try to solve these coding exercises by yourself but if you stuck you can check relevant links or of-course use google to get more insight on them. You can also see more Java programming questions and exercises. Anonymous I was looking for some beginners Java questions for my training course. I loved your collection, they are not too difficult, easy to understand but only thing is that they lack novelty. They are quite old Java questions. Though I would like to use these, I am also putting my own e.g. 1) Write a Java program to get all hashtags and mentioned in a twitter message?

(This would be a good String matching exercise in Java, as you can use regular expression, can split string etc. As hashtags starts with '#' and mentioned strats with '@' character. 2) Count How many characters a String contains, without including any white space e.g.

Write a program that reads in from the user an integer (num) between 1000 and 9999. Then it prompts the user to enter an integer (d) between 0 and 9 and a character (ch). Your program should replace the second and the last digit in num with d and it should display the character that precedes (ch) followed by the number after the change and then the character that comes after (ch). Use the division and modulus operators to extract the digits from num. Sample run: Enter an integer between 1000 and 9999: 2134 Enter a digit (between 0 and 9): 6 Enter a character: b Number was 2134. Result: a2636c.

Anonymous exercise for anyone interested? Write a program that will print the following output 1 1 2 1 1 2 4 2 1 1 2 4 8 4 2 1 1 2 4 8 16 8 4 2 1 1 2 4 8 16 32 18 8 4 2 1 exercise number 2 2. Write a class named “Stock” to model a stock. The properties and methods of the class are shown in figure below. The method “changePercent” computes the percentage of the change of the current price vs the previous closing price.

Write a client program to test the “Stock” class. In the client program, create a Stock object with the stock symbol SUNW, name Sun Microsystem Inc, previous closing price of 100.

Set a new current price randomly and display the price change percentage. Stock private String symbol private String name private double previousClosingPrice private double currentPrice public Stock() public Stock(String symbol, String name) public String getSymbol() public String getName() public double getPreviousClosingPrice() public double getCurrentPrice() public void setSymbol(String symbol) public void setName(String name) public void setPreviousClosingPrice(double price) public void setCurrentPrice(double price) public double changePercent(). Sir can you solve this problem?: Write a java multiple choice examination program. With 10 questions only (need a specific question).

Let the user choose answer and at the end of the program output the total points to the user, output also the number of correct and wrong answer an: if the user got 8-10 say 'Your in A class' f the user got 5-7 say 'Your in B class' f the user got 0-4 say 'Your Fail' Note: 1. Always ask the user if she/he wants to repeat the exam. If yes = repeat the exam 3. If no = exit from the program. Anonymous A good one is given the length of a your output media (how wide your paper or screen is) print Pascal's Triangle in Triangle form. Nazar Se Nazar Mile Mp3 Ringtone Free Download more. Stop when the next line of output will exceed your media width.