Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

I need some fast help with a Java program  RSS feed

 
Michael Ossino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Report post to moderator
Ok i'm finishing up a beginer Java course in College and I got my last Java program/assignment that is supposed to simulate a tv remote, and a vcr remote that inherits the functions from tv remote , beign able to change the channels and volume as well. The tv remote is supposed to change the channels 1-25 relooping them, and the volume 1-10 not relooping them. The vcr is supposed to fast forward, rewind, stop, play, eject and insert the tape. The vcr has a getMode and setMode. The getMode tells the user which mode they are in and gives a message if there isn't a tape in the vcr. The setMmode is supposed to play, stop, fast forward, and rewind. It is only supposed to simulate a remote and will only display what level the volume is, which channel you are on, and which vcr feture is currently in use(play, rewind, ect). I got some help with this but it is still incomplete and I can't tell what i'm doing wrong. I still don't have a way to rewind, fast forward, stop, and play the tape or a way for the user to interface with the program. It was due today but my prof. was kind enough to give me until 9:00a.m tomorrow morning to finish this last assignment. If anyone could give me some help with this i would greatly apprecite it...i've gotten quit lost about halfway through the semester and just trying to finish this lass program. Here is the code that i have so far:
import javax.swing.JOptionPane;

public class TVRemote{
int volume = 5;
int channel = 5;

public void channelUp(){
if(channel < 25){
channel++;
}
}

public void channelDown(){
if(channel > 1){
channel--;
}
}

public void volumeUp(){
if(volume < 10){
volume++;
}
}

public void volumeDown(){
if(volume > 1){
volume--;
}
}
}
public class VCRemote extends TVRemote{
String tape = null;
String mode = "Stop";

public void insertTape(String t){
tape = t;
}

public void ejectTape(){
tape = null;
}

public void setMode(String m){
mode = m;
}

public String getMode(){
return mode;
}
}

public String getMode(){
if(tape == null){
System.out.println("There is no tape");
}
return mode;
}

Again thank you to anyone who can help me. I greatly appreciate it. Thank you.
 
K Ville
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Report post to moderator
Michael, if I weren't busy I could have spent some time figuring your problem out. But I would suggest you search the web via a search engine and look for free source code of a TV Remote simulator program.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is a duplicate of the thread here.
I'm going to ask for this copy to be closed, and anyone who wants to help should see the other thread.
Dave.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!