- Viewing Profile: Topics: ThinkingsHard
Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics
Community Stats
- Group Members
- Active Posts 11
- Profile Views 354
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
128
Neutral
User Tools
Contacts
ThinkingsHard hasn't added any contacts yet.
Latest Visitors
Topics I've Started
Looking for learning tools
14 May 2013 - 02:10 PM
I was self learning some C++, however I'm going to start college in the fall, and the college teaches only Java, so I figured it would be in my best interest to drop C++ for now, and start Java. So, I have PDFS and Books for C++, I was looking for some self learning tools for Java, PDFS, Tutorials, Compilers.
I like Eclipse. Is this a good Compiler, should I use something else, or is it all a matter of opinion?
Any suggestions for software / learning tools I should have would be greatly appreciated.
Requesting Assistance
27 November 2012 - 03:13 PM
Hello!
I have gotten back into my programming groove, after a small break, however I never got very far. I switched from Java to C++, a lot of people suggested I do so, and on top of that, a friend at work uses C++, I hope to eventually go back and learn how to perform the operations in Java, however for now I am sticking with C++.
Anyway, enough about my lifes story! Haha.
I've been reading Stoustrup's Programming Principles and Practice using C++, and I was doing one of the 'drills', when I noticed how ugly the command prompt gets with all the cin and cout in the same window.
I looked around however, I didn't see anything that was readable at my level related to my question.
The Question!
How do I request the inputs to be in a popup / child window instead of the parent / main window, to keep the program cleaner.
( Incoming Code, this is what I have made so far, and I know I don't need to include all of the #include's that I did... But they make me feel happier about my life, which is a good enough reason to have them!)
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
using namespace std;
inline void keep_window_open() { char ch; cin>>ch;}
int main(){
cout<<"Please enter the name of the person you wish to write to.\n";
string first_name;
cin >> first_name;
cout<<"Dear" << " " << first_name <<",\n";
cout<<"How are you?\n";
string first_response;
cin >> first_response;
cout <<"I miss you.\n";
cout << "Please enter the name of our friend.\n";
string friend_name;
cin >> friend_name;
cout << "Have you seen" << " " << friend_name<< " " << "lately?\n";
cout << "Enter the sex of" << " " << friend_name << " " << "as a 'm' or 'f'.\n";
char friend_sex = 0;
cin >> friend_sex;
if (friend_sex == 'm'){
cout<<"If you see" << " " << friend_name <<" " << "please have him call me.\n";
}
if (friend_sex == 'f'){
cout<<"If you see" << " " << friend_name <<" " << "please have her call me.\n";
}
cout<< "Please enter recipients age\n";
int age;
cin >> age;
if (age != 0 && age < 110)
{
cout << "I hear you recently had a birthday, and you are now" << " " << age << " " << "years old.\n";
}
else
{
cout << "You're kidding!";
}
if (age ==17)
{
cout<< "Next year you will be able to vote!";
}
if (age > 70)
{
cout << "I hope you are enjoying retirement!";
}
cout << "Next year you will be" << " " << age+1 << ".\n";
cout << "Yours Sincerely\n";
cout << "\n";
cout << "\n";
string writers_Name;
cin >> writers_Name;
cout << writers_Name;
keep_window_open();
}
Thanks!
I have gotten back into my programming groove, after a small break, however I never got very far. I switched from Java to C++, a lot of people suggested I do so, and on top of that, a friend at work uses C++, I hope to eventually go back and learn how to perform the operations in Java, however for now I am sticking with C++.
Anyway, enough about my lifes story! Haha.
I've been reading Stoustrup's Programming Principles and Practice using C++, and I was doing one of the 'drills', when I noticed how ugly the command prompt gets with all the cin and cout in the same window.
I looked around however, I didn't see anything that was readable at my level related to my question.
The Question!
How do I request the inputs to be in a popup / child window instead of the parent / main window, to keep the program cleaner.
( Incoming Code, this is what I have made so far, and I know I don't need to include all of the #include's that I did... But they make me feel happier about my life, which is a good enough reason to have them!)
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
using namespace std;
inline void keep_window_open() { char ch; cin>>ch;}
int main(){
cout<<"Please enter the name of the person you wish to write to.\n";
string first_name;
cin >> first_name;
cout<<"Dear" << " " << first_name <<",\n";
cout<<"How are you?\n";
string first_response;
cin >> first_response;
cout <<"I miss you.\n";
cout << "Please enter the name of our friend.\n";
string friend_name;
cin >> friend_name;
cout << "Have you seen" << " " << friend_name<< " " << "lately?\n";
cout << "Enter the sex of" << " " << friend_name << " " << "as a 'm' or 'f'.\n";
char friend_sex = 0;
cin >> friend_sex;
if (friend_sex == 'm'){
cout<<"If you see" << " " << friend_name <<" " << "please have him call me.\n";
}
if (friend_sex == 'f'){
cout<<"If you see" << " " << friend_name <<" " << "please have her call me.\n";
}
cout<< "Please enter recipients age\n";
int age;
cin >> age;
if (age != 0 && age < 110)
{
cout << "I hear you recently had a birthday, and you are now" << " " << age << " " << "years old.\n";
}
else
{
cout << "You're kidding!";
}
if (age ==17)
{
cout<< "Next year you will be able to vote!";
}
if (age > 70)
{
cout << "I hope you are enjoying retirement!";
}
cout << "Next year you will be" << " " << age+1 << ".\n";
cout << "Yours Sincerely\n";
cout << "\n";
cout << "\n";
string writers_Name;
cin >> writers_Name;
cout << writers_Name;
keep_window_open();
}
Thanks!
Good tutorials for learning Java?
11 September 2012 - 06:50 PM
Hello. I'm looking to learn Java on my own. I have the textbook "Big Java 4th edition" by Cay Horstman, however seeing as we're on the internet, is there anyplace that can also really teach me a good deal? I'd greatly appreciate any and all tutorials, especially stuff that starts out easy and continues moving into harder and harder stuff. Also, I am attempting some Game Design (I don't want to be just a game designer, however I felt it was a great way to start learning) so anything java related in that area would also help.
Furthermore, and tips, or advice regarding Java would be greatly appreciated
Regards,
ThinkingsHard
Furthermore, and tips, or advice regarding Java would be greatly appreciated
Regards,
ThinkingsHard
Problem with Cannot Find Symbol
11 September 2012 - 12:14 PM
import java.awt.Graphics;
import java.awt.Dimension;
import java.awt.Canvas;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.util.Random;
import javax.swing.JFrame;
// Creates a class called Game that uses the Canvas and implements Runnable
public class Game extends Canvas implements Runnable {
public static final long serialVersionUID = 1L;
// Sets the Height Width and Scale of the frame to unchangeable integers
public static final int HEIGHT = 120;
public static final int WIDTH = 120;
public static final int SCALE = 15;
// Sets NAME to Zuthion ( For use in the JFrame)
public static final String NAME = "Zuthion";
// Buffers all the pixels within the game
private BufferedImage image = new BufferedImage(WIDTH, HEIGHT,BufferedImage.TYPE_INT_RBG);
private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
Random random = new Random();
private boolean running = false;
public void start(){
running = true;
new Thread(this).start();
}
// Since this is a boolean, you don't need to set it to = true to make this true, if I wanted to set this to false,
// I could type while(!running)
public void run(){
while(running){
tick();
render();
}
}
public void stop(){
running = false;
}
public void render(){
BufferStrategy bs = getBufferStrategy();
if(bs == null){
createBufferStrategy(3);
requestFocus();
return;
}
Graphics g = bs.getDrawGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
bs.show();
}
public void tick(){
for (int i = 0; i < pixels.length; i++){
pixels[i] = random.nextInt();
}
}
public static void main(String[] args){
Game game = new Game();
game.setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT* SCALE));
game.setMaximumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
game.setMinimumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
JFrame frame = new JFrame(NAME);
frame.add(game);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
frame.setResizable(true);
game.start();
}
}
Hey. I was going to college taking a bit of first year Java until I was unfortunately unable to continue going to college (Lack of motivations on top of actual phsyical barriers, like my car dieing, and my internet going out for 2 weeks(which dropped me from straight A's to C's and below, because of when it hit)) anyway, I've been trying to learn Java on my own, as I still have my college textbook, and a desire to learn.
I've been reading Tutorials, and looking around for information, Oracle is amazing. Anyway. Here's the Compiler error.
Game.java:32: error: cannot find symbol
private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RBG);
^
symbol: variable TYPE_INT_RBG
location: class Game
1 error
I'm not sure why I'm getting this error, and I feel like I either forgot to import something, or I am missing something from my java libraries. If anyone could help with this, I would greatly appreciate it.
import java.awt.Dimension;
import java.awt.Canvas;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.util.Random;
import javax.swing.JFrame;
// Creates a class called Game that uses the Canvas and implements Runnable
public class Game extends Canvas implements Runnable {
public static final long serialVersionUID = 1L;
// Sets the Height Width and Scale of the frame to unchangeable integers
public static final int HEIGHT = 120;
public static final int WIDTH = 120;
public static final int SCALE = 15;
// Sets NAME to Zuthion ( For use in the JFrame)
public static final String NAME = "Zuthion";
// Buffers all the pixels within the game
private BufferedImage image = new BufferedImage(WIDTH, HEIGHT,BufferedImage.TYPE_INT_RBG);
private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
Random random = new Random();
private boolean running = false;
public void start(){
running = true;
new Thread(this).start();
}
// Since this is a boolean, you don't need to set it to = true to make this true, if I wanted to set this to false,
// I could type while(!running)
public void run(){
while(running){
tick();
render();
}
}
public void stop(){
running = false;
}
public void render(){
BufferStrategy bs = getBufferStrategy();
if(bs == null){
createBufferStrategy(3);
requestFocus();
return;
}
Graphics g = bs.getDrawGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
bs.show();
}
public void tick(){
for (int i = 0; i < pixels.length; i++){
pixels[i] = random.nextInt();
}
}
public static void main(String[] args){
Game game = new Game();
game.setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT* SCALE));
game.setMaximumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
game.setMinimumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));
JFrame frame = new JFrame(NAME);
frame.add(game);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
frame.setResizable(true);
game.start();
}
}
Hey. I was going to college taking a bit of first year Java until I was unfortunately unable to continue going to college (Lack of motivations on top of actual phsyical barriers, like my car dieing, and my internet going out for 2 weeks(which dropped me from straight A's to C's and below, because of when it hit)) anyway, I've been trying to learn Java on my own, as I still have my college textbook, and a desire to learn.
I've been reading Tutorials, and looking around for information, Oracle is amazing. Anyway. Here's the Compiler error.
Game.java:32: error: cannot find symbol
private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RBG);
^
symbol: variable TYPE_INT_RBG
location: class Game
1 error
I'm not sure why I'm getting this error, and I feel like I either forgot to import something, or I am missing something from my java libraries. If anyone could help with this, I would greatly appreciate it.
- Home
- » Viewing Profile: Topics: ThinkingsHard

Find content