I have like atleast 15 errors that say class, interface, or enum expected and I have no idea what that means. Can someone tell me what it is and how I might be able to fix it?
Thank you.
- Manny
*Program Purpose: This program processes the results for the 2008 Democratic and/or Republican presidential
primary elections. -
-
import staugIO.StaugIO;
-
public class Primaries2008{
-
-
-
-
//DECLARE PRIVATE VARIABLES****************************************************************************************************
-
private int choice, count1 , count2, count3, count4, totalCount, whichPrimary,
-
democraticPrimaryCount, republicanPrimaryCount;
-
private double candidate1, candidate2, candidate3, candidate4;
-
private char answer;
-
private char anotherVoter = 'V';
-
private boolean anotherPrimary = false;
-
private String tab5 = " ";
-
private String tab3 = " ";
-
private String democraticResults = "2008 Democratic Primary Preliminary Results";
-
private String republicanResults = "2008 Republican Primary Preliminary Results";
-
private StaugIO io;
-
private DecimalFormat percent = new DecimalFormatter("##0%");
-
-
-
-
//FIRST LEVEL OF REFINEMENT METHODS*********************************************************************************************
-
public void beginPrimary()
-
{
-
do
-
{
-
int totalCount = 0;
-
int count1 = 0;
-
int count2 = 0;
-
int count3 = 0;
-
int count4 = 0;
-
double candidate1 = 0.0;
-
double candidate2 = 0.0;
-
double candidate3 = 0.0;
-
double candidate4 = 0.0;
-
-
-
-
do{
-
private void selectPrimary()
-
{//BEGIN selectPrimary
-
if((whichPrimary <= 0 ) || (whichPrimary > 2));
-
{
-
io.writeInfo("Invalid primary choice!");
-
}
-
-
else{
-
switch(whichPrimary)
-
{
-
case 1: ++democraticPrimaryCount; break;
-
case 2: ++republicanPrimaryCount; break;
-
}
-
}//END IF
-
-
}//END selectPrimary
-
-
-
-
-
if((democraticPrimaryCount == 1) && (republicanPrimaryCount == 1));
-
{
-
anotherPrimary = false;
-
}
-
-
while ((whichPrimary <> 1 ) && (whichPrimary <> 2))
-
-
-
-
-
do{
-
if(whichPrimary == 1);
-
{//BEGIN IF
-
private democraticPrimary()
-
{//BEGIN democraticPrimary
-
switch(choice)
-
{//BEGIN switch
-
case 1: io.writeInfo("1. Hillary Clinton"); break;
-
case 2: io.writeInfo("2. Barack Obama"); break;
-
case 3: io.writeInfo("3. John Edwards"); break;
-
case 4: tallyVote();break;{
-
}
-
-
default: io.writeInfo("Invalid candidate choice!"); break;
-
anotherVoter = 'v';
-
-
}//END Switch
-
-
}//END democraticPrimary
-
-
}//END IF
-
-
-
if((choice > 0) && (choice < 5));
-
{
-
answer = io.writeInfo("Thank you! Your vote has been recorded.\n\n");
-
io.writeInfo("Election Official:\n\n");
-
io.writeInfo("To reset for another primary enter 'P'.");
-
io.writeInfo("\nTo exit and get preliminary primary results enter 'E'.");
-
}
-
-
-
-
if((answer == 'v') || (answer == 'V'))
-
{
-
anotherVoter == answer;
-
}
-
else
-
if((answer == 'p') || (answer == 'P'))
-
{
-
anotherVoter = 'e';
-
anotherPrimary = false;
-
}
-
-
while((anotherVoter == 'v') || (anotherVoter == 'V'));
-
-
}//END DO
-
-
if(whichPrimary == 1)
-
{
-
democraticPrimaryWinner();
-
}
-
-
else
-
{
-
republicanPrimaryWinner();
-
}
-
-
-
-
-
-
-
while(anotherPrimary = true)
-
-
}//END DO
-
-
-
if((democraticPrimaryCount == 1) && (republicanPrimaryCount == 1))
-
{
-
io.writeInfo("\nTwo primaries have already been processed.");
-
io.writeInfo("\n\nPrimary election results will follow!");
-
io.writeInfo(democraticResults);
-
io.writeInfo(republicanResults);
-
else
-
if(whichPrimary == 1)
-
{
-
io.writeInfo(democraticResults);
-
else
-
io.writeInfo(republicanResults);
-
}
-
-
}
-
}
-
}
-
-
}//RETURN
-
-
-
//SECOND LEVEL OF REFINEMENT*******************************************************************************
-
-
-
private selectPrimary()
-
{//BEGIN selectPrimary
-
-
whichPrimary = io.writeInfo("Election Official: Which primary election are you setting for? ");
-
io.writeInfo("\n\n1. Democratic Primary");
-
io.writeInfo("\n2. Republican Primary");
-
-
}//RETURN selectPrimary
-
-
-
-
-
private democraticPrimary()
-
{//BEGIN democraticPrimary
-
choice = io.writeInfo("ELECTION 2008 REPUBLICAN PRIMARY\n\n");
-
io.writeInfo("1. Hillary Clinton\n");
-
io.writeInfo("2. Barack Obama\n");
-
io.writeInfo("3. John Endwards\n\n");
-
-
io.writeInfo("Enter the number for the presidential candidate of your choice: \n\n");
-
}//RETRUN democraticPrimary
-
-
-
private republicanPrimary()
-
{
-
choice = io.writeInfo("ELECTION 2008 REPUBLICAN PRIMARY\n\n");
-
io.writeInfo("1. Rudy Giuliani\n");
-
io.writeInfo("2. Fred Thompson\n");
-
io.writeInfo("3. Mitt Romney\n");
-
io.writeInfo("4. John McCain\n\n");
-
io.writeInfo("Enter the number for the presidential candidate of your choice: \n\n")
-
-
}//RETURN republicanPrimary
-
-
-
private tallyVote()
-
{//BEGIN tallyVote
-
switch(choice)
-
{
-
case 1: ++count1;break;
-
case 2: ++count2;break;
-
case 3: ++count3;break;
-
case 4: ++count4;break;
-
}
-
++totalCount;
-
}//RETURN tallyVote
-
-
-
-
private democraticPrimaryWinner()
-
{
-
candidate1 = (double)(count1)/totalCount;
-
candidate2 = (double)(count2)/totalCount;
-
candidate3 = (double)(count3)/totalCount;
-
-
democraticResults += ("\n\n1. Hillary clinton" + tab5 + tab5 + percent.format(candidate1)
-
+ "\n2. Barack Obama " + tab5 + percent.format(candidate2)
-
+ "\n3. John Edwards " + tab5 + percent.format(candidate3) + "\n\n");
-
-
-
}//RETURN democraticPrimaryWinner
-
-
-
-
private republicanPrimaryWinner()
-
{
-
candidate1 = (double)(count1)/totalCount;
-
candidate2 = (double)(count2)/totalCount;
-
candidate3 = (double)(count3)/totalCount;
-
candidate4 = (double)(count4)/totalCount;
-
-
republicanResults += ("\n\n1. Fred Thompson" + tab5 + tab5 + percent.format(candidate2)
-
+ "\n2. Rudy Giuliani" + tab5 + percent.format(candidate1)
-
+ "\n3. Mitt Romney " + tab5 + percent.format(candidate3) + "\n\n"
-
+ "\n4. John McCain " + tab5 + tab5 percent.format(candidate4) + "\n\n");
-
-
-
}//RETURN republicanPrimaryWinner
-
-
}//RETURN beingPrimary
-
-
-
}//END class PRIMARIES2008
-
-
-
-
-
-
public static void main(String[] args) {
-
-
-
-
-
}
-
-
-
2 16271 Ganon11 3,652
Recognized Expert Specialist
I'm sure our experts will be able to help you, but you need to post in the proper place. The Articles section has a different purpose than the regular Forums, and isn't the place for this kind of post. I'll move your post now.
JosAH 11,448
Recognized Expert MVP
I have like atleast 15 errors that say class, interface, or enum expected and I have no idea what that means. Can someone tell me what it is and how I might be able to fix it?
Thank you.
- Manny
Your curly brackets don't match up; check each and every one of them, i.e each
{ needs a matching } somewhere down the code. Most editors can help you with
this boring little task.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Brian Riis |
last post by:
This all pertains to the above mentioned article. Anyone want to read it
(it's rather neat, actually), here's the address:
http://www.cuj.com/documents/s=8205/cujweb0305meynard/
Anyway, I was trying to work my way through the idea of the class,
especially the one, that uses a template parameter for the enumeration
value, in the hopes of getting an enum that enumerated through std::strings.
The whole idea is to keep a base class with...
|
by: Bill Cohagan |
last post by:
I've got an abstract class (say foo) and I'd like to define an Enum (say
bar) within that class so that I can then refer to foo.bar.<one of the enum
labels> from within other parts of the program. The enum is *public* in
other words.
What I find is that while the compiler allows the enum declaration within
the abstract class, it turns out that the enum type isn't visible from
outside the class. It is visible from within descendant...
|
by: craigkenisston |
last post by:
Hi,
I will use an example to do a simplified description of my problem,
please don't laugh.
I just "believe" I would have to use either interface or abstract
classes, but I've not ever write an interface, though I know the basis
of
interfaces.
|
by: Lee Franke |
last post by:
I can't seem to figure this one out.
Here is my class structure
namespace name
{
public class foo
{
}
}
|
by: David A. Osborn |
last post by:
I have a set of classes that each have an enumeration in them, and based on
dynamic input I need to access a different enumeration. For example
Three classes Class_A, Class_B, and Class_C that all have a different
enumeration in them called Properties. I want to basically have a variable
The_Class that I can dynamically point to either Class_A, Class_B, or
Class_C and then do The_Class.properties to get the correct enumeration.
How...
| |
by: Randy |
last post by:
Hi,
Can anyone point me to a complete, compilable example
of Besser's ENUM++ mechanism? I downloaded it from
CUJ and gave it a try but got errors just trying to compile
the header enum.h.
--Randy Yates
|
by: Randy |
last post by:
Hi,
I downloaded and tried the ENUM++ code from CUJ
http://www.cuj.com/documents/s=8470/cujboost0306besser/
but can't even get it to compile (see following). I
have also downloaded and installed the boost library.
This is using gcc under FC3.
|
by: Randy |
last post by:
Hi,
I downloaded and tried the ENUM++ code from CUJ
http://www.cuj.com/documents/s=8470/cujboost0306besser/
but can't even get it to compile (see following). I
have also downloaded and installed the boost library.
This is using gcc under FC3.
|
by: nospam |
last post by:
Hello -
I am getting a compile error "Expected class, delegate, enum".
I am trying to create a Class Library in C# which wraps around an unmanaged
DLL that manages a MIDI interface.
In my Class Library code, I have tried to put a DllImport to the Win32
function MessageBox. Just to test out the DllImport functionality before I
add my custom functions that I want to wrap.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |