Need help figuring out how to deal with inheritence issues
So I have these two classes, one's called MC, which represents a Multiple-Choice question, and one's called TF, which represents a True/False question. It would make sense to have TF inherit from MC, since TF is simple a MC question with two set options (true and false!).
So it would also make sense for the constructor for MC to take a prompt (the question itself) and a Vector of Strings for choices, like so:
MC(String prompt, Vector<String> choices);
And then the TF constructor would just take a prompt (since the choices are always going to be true and false) and just pass a preset vector to the MC constructor, like so
TF(String prompt);
However, here's where the problem lies. Since I can must call my super constructor first, I have no way to initialize my preset Vector of choices (true and false). I could have a seperate MC constructor for handling this, but a parent class should not have to know what a child class needs to do, right? I need a quick and relatively proper solution for this if anyone has one. Thanks in advance!
private static final List CHOICES = new ArrayList();
static {
CHOICES.add("True");
CHOICES.add("False");
public TrueFalse(final String question) {
super(question, CHOICES);
}For the record, if I were doing this, I'd make an interface called "Question" and have both TrueFalse and MultipleChoice implement it. If there were similar functionality, I'd put it in an abstract class AbstractQuestion, then have TrueFalse and MultipleChoice extend AbstractQuestion and implement Question.
Similar Messages
-
I have a mac 10.5 and need help figuring out how to change my email settings so it does not automatically delete my inbox every 30 days. How to I adjust the mail settings?
I think it must be an IMAP account then, & in Mail>Preferences>Accounts>Advanced>Keep copies for Offline viewing:>Don't keep copies, then on the Server, or maybe it's just this one itself, but on the Server you have a setting to remove eMails after 30 days.
If it's a POP account we'd have to investigate that... but you didn't say so I'm guessing here. -
How do I get my previous contacts from mobileme now to the icloud? I need help figuring out how to make that transition?
Try using the app My Contacts Backup, which will back up your contacts as an attachment to an email. Send this email to yourself, open it on your Mac and double-click the attachment to import them to Address Book (or Contacts if you have Mountain Lion).
-
Need Help figuring out how to alphabetize itunes artist.
I need help figuring out one more thing. I have my artist tab in my itunes library and I need to figure out how to get all the artists grouped together instead of being scattered all around.
This is how it looks now:
Justin Timberlake
Linkin Park
Linkin Park
Linkin Park
Justin Bieber
Daughtry
Linkin Park
Linkin Park
JoJo
Linkin Park
This is how I want it to look:
Daughtry
Justin Timberlake
Justin Bieber
JoJo
Linkin Park
Linkin Park
Linkin Park
Linkin Park
Linkin Park
Please help! Thanks!Enable the Sort Artist, Album Artist and Sort Album Artist columns so you can see what is going on. Album Artist normally takes precedence over Artist, with the Sort fields further controlling the order.
See also Grouping tracks into albums.
tt2 -
Need Help Figuring Out How to Access On/Off Field in Upper Left Hand Corner
I am hoping someone can help as I am not at all TECHNICALLY SAVVY!! I must have hit some wrong button yestyerday because now I cannot get access to my messages on my Blackberry Curve. I think it may be because the word OFF appears at the top of the screen on my Blackberry on the far left hand side and I cannot figure out how to access that part of the screen to change it to say ON.
Well, give it a few minutes, and if after 15 minutes no new email messages, Do a simple reboot on the BlackBerry in this manner: With the BlackBerry device POWERED ON, remove the battery for a minute, and then reinsert the battery to reboot. A reboot in this manner is prescribed for most glitches and operating system errors, and you will lose no data on the device doing this.
Meanwhile, if you've read or deleted any of the email sent in the interim from your PC, you won't be getting it on your BlackBerry.
1. If any post helps you please click the below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
4. Guide to Unlocking your BlackBerry & Unlock Codes
Join our BBM Channels (Beta)
BlackBerry Support Forums Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
Hi Everyone,
I am working on a project that uses SharePoint 2010 for repository and we have multiple tables that we are using.
One table is a list of the various projects we are working on (workstreams)
The other is a table with various notes and such, to include meeting notes for the various projects.
Currently we are just copying the shortcut from the meeting notes table and adding it in as a link in the workstreams status table.
I need to find out if there is some sort of way to make this process dynamic so that when a new note is added for, lets say workstream #1 in the notes table, it will automatically propogate into the notes link section for workstream #1.
Is this even possible??
And if so how would I do it
I haven't done much with modifying SharePoint in several years, and would Truly appreciate any and all help with this.
Thanks in advance
IKEHi IKE,
According to your description, my understanding is that you want to create a link in the workstreams list linked to the associated item of the notes list.
Assuming the workstreams list has Title column and another column called “Note” used to linked to notes list, and the notes list has Title column and another column used to store note.
Then you can create a workflow on the notes list with SharePoint Designer 2010, and in the workflow, using “Update ListItem” action. And in the workflow Start Options, select “Start workflow automatically when an item is created”.
For the workflow action, you can set as the screenshot:
For the string in the String Builder, you need to open an item of notes list, then copy the URL of the display form and paste here, the URL will look something like this:
http://sp/Lists/notes/DispForm.aspx?ID=1&Source=http%3A%2F%2Fsp%2FLists%2Fnotes%2FAllItems%2Easpx&ContentTypeId=0x0100300025278693CE49A5E3A394B23AD9E1&IsDlg=1
Now, you need to replace the ID of the item using [%Current Item:ID%], for example in the above link, delete the number 1 and add [%Current Item:ID%].
Best Regards,
Wendy
Wendy Li
TechNet Community Support -
I need help figuring out what is wrong with my Macbook Pro
I have a mid 2012 Macbook Pro with OS X Mavericks on it and for the past few weeks it has running VERY SLOW! I have no idea what is wrong with it, i have read other discussion forums trying to figure it out on my own. So far i have had no luck in fixing the slowness. When i open applications the icon will bounce in dock forever before opening and then my computer will freeze with the little rainbow wheel circling and circling for a few minutes... and if i try to browse websites it take forever for them to load or youtube will just stop working for me. Everything i do, no matter what i click, the rainbow wheel will pop up! The only thing i can think of messing it up was a friend of mine plugging in a flash drive a few weeks ago to take some videos and imovie to put on his Macbook Pro, he has said his laptop has been running fine though... so idk if that was the problem. Anyways, could someone please help me try something? Thank you!!
OS X Mavericks: If your Mac runs slowly?
http://support.apple.com/kb/PH13895
Startup in Safe Mode
http://support.apple.com/kb/PH14204
Repair Disk
Steps 1 through 7
http://support.apple.com/kb/PH5836
Reset SMC. http://support.apple.com/kb/HT3964
Choose the method for:
"Resetting SMC on portables with a battery you should not remove on your own".
Increase disk space.
http://support.apple.com/kb/PH13806 -
Need help figuring out what's wrong with my code!
I am having a few problems with my code and can't see what I've done wrong. Here are my issues:
#1. My program is not displaying the answers to my calculations in the table.
#2. The program is supposed to pause after 24 lines and ask the user to hit enter to continue.
2a. First, it works correctly for the first 24 lines, but then jumps to every 48 lines.
2b. The line count is supposed to go 24, 48, etc...but the code is going from 24 to 74 to 124 ... that is NOT right!
import java.text.DecimalFormat; //needed to format decimals
import java.io.*;
class Mortgage2
//Define variables
double MonthlyPayment = 0; //monthly payment
double Principal = 200000; //principal of loan
double YearlyInterestRate = 5.75; //yearly interest rate
double MonthlyInterestRate = (5.75/1200); //monthly interest rate
double MonthlyPrincipal = 0; //monthly principal
double MonthlyInterest = 0; //monthly interest
double Balance = 0; //balance of loan
int TermInYears = 30; //term of loan in yearly terms
int linecount = 0; //line count for list of results
// Buffered input Reader
BufferedReader myInput = new BufferedReader (new
InputStreamReader(System.in));
//Calculation Methods
void calculateMonthlyPayment() //Calculates monthly mortgage
MonthlyPayment = Principal * (MonthlyInterestRate * (Math.pow(1 + MonthlyInterestRate, 12 * TermInYears))) /
(Math.pow(1 + MonthlyInterestRate, 12 * TermInYears) - 1);
void calculateMonthlyInterestRate() //Calculates monthly interest
MonthlyInterest = Balance * MonthlyInterestRate;
void calculateMonthlyPrincipal() //Calculates monthly principal
MonthlyPrincipal = MonthlyPayment - MonthlyInterest;
void calculateBalance() //Calculates balance
Balance = Principal + MonthlyInterest - MonthlyPayment;
void Amortization() //Calculates Amortization
DecimalFormat df = new DecimalFormat("$,###.00"); //Format decimals
int NumberOfPayments = TermInYears * 12;
for (int i = 1; i <= NumberOfPayments; i++)
// If statements asking user to enter to continue
if(linecount == 24)
System.out.println("Press Enter to Continue.");
linecount = 0;
try
System.in.read();
catch(IOException e) {
e.printStackTrace();
else
linecount++;
System.out.println(i + "\t\t" + df.format(MonthlyPrincipal) + "\t" + df.format(MonthlyInterest) + "\t" + df.format(Balance));
//Method to display output
public void display ()
DecimalFormat df = new DecimalFormat(",###.00"); //Format decimals
System.out.println("\n\nMORTGAGE PAYMENT CALCULATOR"); //title of the program
System.out.println("=================================="); //separator
System.out.println("\tPrincipal Amount: $" + df.format(Principal)); //principal amount of the mortgage
System.out.println("\tTerm:\t" + TermInYears + " years"); //number of years of the loan
System.out.println("\tInterest Rate:\t" + YearlyInterestRate + "%"); //interest rate as a percentage
System.out.println("\tMonthly Payment: $" + df.format(MonthlyPayment)); //calculated monthly payment
System.out.println("\n\nAMORTIZATION TABLE"); //title of amortization table
System.out.println("======================================================"); //separator
System.out.println("\nPayment\tPrincipal\tInterest\t Balance");
System.out.println(" Month\t Paid\t\t Paid\t\tRemaining");
System.out.println("--------\t---------\t--------\t-------");
public static void main (String rgs[]) //Start main function
Mortgage2 Mortgage = new Mortgage2();
Mortgage.calculateMonthlyPayment();
Mortgage.display();
Mortgage.Amortization();
ANY help would be greatly appreciated!
Edited by: Jeaneene on May 25, 2008 11:54 AMFrom [http://developers.sun.com/resources/forumsFAQ.html]:
Post once and in the right area: Multiple postings are allowed, but they make the category lists longer and create more email traffic for developers who have placed watches on multiple categories. Because of this, duplicate posts are considered a waste of time and an annoyance to many community members, that is, the people who might help you. -
Need help figuring out how to make all images appear on every page
Hello,
I user Dreamweaver MX and created this site for my church
www.ccosj.com. When I created the site I used image ready for the
ind. parts of the page. Loading them into dreamweaver and adjusting
the rollovers there (with some tutorial help since I am not that
good at it) I get the pages all to look great on my computer but
when uploading to the site, every page I click on all the images
reload and therefore the pictures constantly look as if they are
reloading. What am I doing wrong? should I take the preload script
out? Why does it look good on my computer but not on the site? Any
help would be appreciated but please know I am a novice at this.
BernadetteUpdate it using iTunes on your computer instead of trying to do it over the air. The space requirement doesn't apply.
In addition, when doing so, you can choose download only initially, allowing you to unplug the phone and go about your day while iOS downloads. Then, when it's finished downloading, you can plug it in and update it without having to wait. -
I need help figuring out how to put pics over video
How do I put pictures over video while keeping the audio from the video? I am using Premiere Elements 9.
Do you want the pictures to fill your video frame or do you want them smaller than the video frame so that the video shows behind them?
Have a look at my sample "Add Motion Behind Your Slideshow" sample and see if that's what you're trying to do.
http://muvipix.com/cooltricks.php
In any event, you put the video on one video track and the photos on a track above it, basically.
There's much more to explain, but before we get too deeply into that, we need to know exactly what you're trying to do. Can you link us to a YouTube video example? -
Just in case that wasn't specific enough....It's an older ipod touch. He gave it to me as a Christmas gift and I want to keep the songs and Apps he already has on it but I want to be able to add more to it which means I would need it on my own itunes account because I can't add anything to it without a password.
I'd suggest restoring it to make sure you start completely clean:
http://support.apple.com/kb/HT1414
Then you can sync whatever content you wish:
http://www.apple.com/support/ipodtouch/
Regards. -
I need help figuring out how to use my print screen key
I have an HP Pavilion Entertainment PC dv7-1245. The key is above the num lock key - it has "home" which works when I press it but under that it has "prt sc" but I don't know what to hit along with it to make it work. I tried the shift key, the alt key, the fn key and nothing works. I even looked in the manual and those keys above the num lock key are not even referenced.
to capture active windows the key combo is ctrl+alt+fn+print sc
Although I am an HP employee, I am speaking for myself and not for HP.
Make it easier for other people to find solutions, by marking my answer with 'Accept as Solution', if it solves your problem.
Click on the BLUE KUDOS button on the left to say "Thanks" -
I need help figuring out how to creat a button listener for my panel
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Scanner;
public class ExpressionCalculatorPanel extends JPanel
// Variables to be used
private JLabel inputLabel, resultLabel;
private JTextField ExpressionCalculator;
private JButton computeButton;
// Constructor: Sets up the main GUI components.
public ExpressionCalculatorPanel()
inputLabel = new JLabel ("Enter a value of x");
resultLabel = new JLabel ("Final result = ---");
ExpressionCalculator = new JTextField (5);
ExpressionCalculator.addActionListener(new ButtonListener());
// Set buttons and listeners
computeButton = new JButton("Compute Final Result");
computeButton.addActionListener(new ButtonListener());
// Add to panels
add (computeButton);
add (inputLabel);
add (resultLabel);
setPreferredSize (new Dimension(300, 75));
setBackground (Color.white);
// Represents an action listener for the temperature input field.
private class ButtonListener implements ActionListener
// Performs the conversion when the enter key is pressed in
// the text field.
public void actionPerformed (ActionEvent event)
}import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Scanner;
public class ExpressionCalculatorPanel extends JPanel
// Variables to be used
private JLabel inputLabel, resultLabel;
private JTextField ExpressionCalculator;
private JButton computeButton;
// Constructor: Sets up the main GUI components.
public ExpressionCalculatorPanel()
inputLabel = new JLabel ("Enter a value of x");
resultLabel = new JLabel ("Final result = ---");
ExpressionCalculator = new JTextField (5);
ExpressionCalculator.addActionListener(new ButtonListener());
// Set buttons and listeners
computeButton = new JButton("Compute Final Result");
computeButton.addActionListener(new ButtonListener());
// Add to panels
add (computeButton);
add (inputLabel);
add (resultLabel);
setPreferredSize (new Dimension(300, 75));
setBackground (Color.white);
// Represents an action listener for the temperature input field.
private class ButtonListener implements ActionListener
// Performs the conversion when the enter key is pressed in
// the text field.
public void actionPerformed (ActionEvent event)
} -
Need help figuring out how to pay for my renewal for Adobe Premiere. Anyone can tell me what to do?
Thanks!Go to this webpage:
Creative Cloud pricing and membership plans | Adobe Creative Cloud
Click on the chat button (in the lower center of the page) or use the telephone number there.
MtD -
I need to find a new email provider. One that integrates well with apple's 'mail.' I will also need to figure out how to notify everyone in my 'address book' of my change. I've been okay with earthlink but it's getting too expensive. Can anyone help? Jack
I use a OLD G3 when I travel and mostly I am connecting over the satellites which is not really the best connection.
I use GMX which is free and never have a problem getting my emails from anywhere even in the middle of the oceans.
It does work using Apple mail and the adress book
Maybe you are looking for
-
IMac 24 C2D freezing, beach ball, pinwheel
Hello wonderful user community! I am helping my wife with this issue, she's never posted on the ASC before. In the last two weeks my iMac has started behaving strangely. It doesn't seem to matter whether running Spotify, Chrome, Firefox, or other a
-
XI Server Hard disk full, no space available
Hi Everyone.... XI Server Hard disk, is full. Its showing Zero Bytes. Even there is no option to add another hard disk now. Even though Log files are deleted, it showing zero bytes. Please provide a solution as soon as possible.
-
Hello, we have output ZROS configured. No custom enhancements. Sandard EDI output us attached to it. In the config of output type, we have "multiple issue" ticked. 1) what is the meaning of multiple issuing. does it mean, that whenever someone goes i
-
Suppress confirmation tone when sending text on 62...
Hi Is there anyway to suppress the confirmation tone when a text message is sent without using a silent profile? This is on a 6233. I want to be able to send a text message silently, but still have my selected ring tone, etc active.
-
Autocompletion of email addresses
I've found that when I'm typing email addresses into a pages document, it helpfully autoformats them as clickable "mail to" links (so you can click them and open a mail message to that person). However, it is also doing something very weird when auto