COP1000 - Introduction to programming Logic

Modules - Arguments


What is the difference in passing an argument by value versus passing it by reference


Log in to post an answer

Answer by dwain on October 5, 2015 2:38 AM

When you pass and argument by value you only send a copy of the value stored in the argument to the parameter variable, thus the module called is not able to modify the argument in the calling module. When you pass an argument by reference you create a two way communication between the calling module and the receiving parameter variable. The module called is able to modify the value stored in the argument.

COP1000 - Introduction to Programming Logic

Repitition Structure - Condition-controlled Structure


Is the While loop a pre-test structure?


Log in to post an answer

Answer by dwain on October 3, 2015 2:38 AM

Yes. The while loop is a pre-test structure, it test a condition first then it executes some statements as long as that condition is true, if and when that condition is false, it exits the loop.

SPN1121 -

Grammer - Indirect Object


What is the correct pronoun to use when the object is mi?


Log in to post an answer

CHM1045 -

Chemical Reactions - Ionic equations


What is the first step in finding out if two compounds will react or not?


Log in to post an answer

MAC2311 -

Extrema on an Interval - Critical Numbers


In trying to find the critical numbers in;

f(x) = x3 - 3x2

I have the derivative as

f ' (x) = 3x2 - 6x

But whats the next step from here?

---------------------------------------------

f of x = x cube - 3x square

f of x equal x cube minus three x square

Problem from Ron Larson Calculus 10th Edition Section 3.1 - no. 11


Log in to post an answer

Answer by dwain on October 14, 2015 6:36 PM

The next step is to set the equation equal 0, then factor out a 3x as in:

3x2 - 6x = 0

3x(x - 2) = 0

3x = 0 and x - 2 = 0

x = 0 and x = 2

0 and 2 are the critical numbers


MAC2311 -

Extrema on an Interval - Finding Min and Max values


In section 3.1, for homework question 29, what is the first step in finding the deravitive of the problem;

y space equals space 3 space minus space left enclose t space minus space right enclose 3 end enclose space comma space space space space space space space space space space space space open square brackets minus 1 comma space 5 close square brackets

and then how do I go on to find the deravitive?


Log in to post an answer

CNT2000 -

Models - OSI Model


Which of the following OSI layers converts the ones and zeroes to electrical signals and places them on the cable?

 

A. Physical layer

B. Transport layer

c. Network layer

D. Data link layer


Log in to post an answer

Answer by dwain on April 18, 2016 8:26 PM

Physical Layer

The Nic take care of converting one and zeros to an electrical signal. Even though the Nic resides in the data link layer, it operates in both the physical and the data link area.

COP1220 - Introduction to Programming in C

Control Structure - While loop


What element is used as an increment  in a while loop?


Log in to post an answer

Answer by dwain on January 25, 2016 10:39 PM

A counter is used to increment in a while loop. It is important to note that the counter should reach an exit point so the program is not stuck in a while loop


COP1220 - Introduction to Programming in C

Control Structure - While loop


What element is used as an increment  in a while loop?


Log in to post an answer

Answer by dwain on January 25, 2016 10:39 PM

A counter is used to increment in a while loop. It is important to note that the counter should reach an exit point so the program is not stuck in a while loop


COP1220 - Introduction to Programming in C

Control Structure - While loop


What element is used as an increment  in a while loop?


Log in to post an answer

Answer by dwain on January 25, 2016 10:39 PM

A counter is used to increment in a while loop. It is important to note that the counter should reach an exit point so the program is not stuck in a while loop


COP1220 - Introduction to Programming in C

Control Structure - While loop


What element is used as an increment  in a while loop?


Log in to post an answer

Answer by dwain on January 25, 2016 10:39 PM

A counter is used to increment in a while loop. It is important to note that the counter should reach an exit point so the program is not stuck in a while loop


COP1220 - Introduction to Programming in C

Array - Single Subscript Arrays


My Program compiles and run but it does not add up the amount of employes that meet the salary ranges, it displays all zeroes all the time, can you help guys?

 

// Exercise 6.10 How to Program in C by Paul Deitel & Harvey Deitel Seventh Edition
#include <stdio.h>
#include <stdlib.h>
#define BASE 10;
//#define RATE 0.09;

int main (void) {

int sales;
int range[9] = {0};
int salary;

while (sales != -1) {

    printf ("Enter sales amount for employee(Enter -1 to end program): ");
    
    scanf("%d", &sales);    
 
    salary = BASE + 0.09 * sales;

    if (salary >= 200 && salary <= 299){
    range[0] = range[0] + 1;
    }

    if (salary >= 300 && salary <= 399){
    range[1] += 1;
    }

    if (salary >= 400 && salary <= 499){
    range[2] += 1;
    }

    if (salary >= 500 && salary <= 599){
    range[3] += 1;
    }

    if (sa lary >= 600 && salary <= 699){
    range[4] += 1;
    }

    if (salary >= 700 && salary <= 799){
    range[5] += 1;
    }

    if (salary >= 800 && salary <= 899){
    range[6] += 1;
    }

    if (salary >= 900 && salary <= 999){
    range[7] += 1;
    }

    if (salary >= 1000){
    range[8] += 1;
    }
} // Ends while loop to get sales info

    printf ("%d employees made salaries between 200 & 299 ", range[0]);
    printf ("%d employees made salaries between 300 & 399 ", range[1]);
    printf ("%d employees made salaries between 400 & 499 ", range[2]);
    printf ("%d employees made salaries between 500 & 599 ", range[3]);
    printf ("%d employees made salaries between 600 & 699 ", range[4]);
    printf ("%d employees made salaries between 700 & 799 ", range[5]);
    printf ("%d employees made salaries between 800 & 899 ", range[6]);
    printf ("%d employees made salaries between 900 & 999 ", range[7]);
    printf ("%d employees made salaries over 1000 ", range[8]);

} // Ends main


Log in to post an answer

Answer by dwain on March 29, 2016 8:19 PM

Remove BASE and just use 200.

In the line "if (sa lary >= 600 && salary <= 699){" change to "if (salary >= 600 && salary <= 699){".


COP1220 - Introduction to Programming in C

Array - Single Subscript Arrays


My Program compiles and run but it does not add up the amount of employes that meet the salary ranges, it displays all zeroes all the time, can you help guys?

 

// Exercise 6.10 How to Program in C by Paul Deitel & Harvey Deitel Seventh Edition
#include <stdio.h>
#include <stdlib.h>
#define BASE 10;
//#define RATE 0.09;

int main (void) {

int sales;
int range[9] = {0};
int salary;

while (sales != -1) {

    printf ("Enter sales amount for employee(Enter -1 to end program): ");
    
    scanf("%d", &sales);    
 
    salary = BASE + 0.09 * sales;

    if (salary >= 200 && salary <= 299){
    range[0] = range[0] + 1;
    }

    if (salary >= 300 && salary <= 399){
    range[1] += 1;
    }

    if (salary >= 400 && salary <= 499){
    range[2] += 1;
    }

    if (salary >= 500 && salary <= 599){
    range[3] += 1;
    }

    if (sa lary >= 600 && salary <= 699){
    range[4] += 1;
    }

    if (salary >= 700 && salary <= 799){
    range[5] += 1;
    }

    if (salary >= 800 && salary <= 899){
    range[6] += 1;
    }

    if (salary >= 900 && salary <= 999){
    range[7] += 1;
    }

    if (salary >= 1000){
    range[8] += 1;
    }
} // Ends while loop to get sales info

    printf ("%d employees made salaries between 200 & 299 ", range[0]);
    printf ("%d employees made salaries between 300 & 399 ", range[1]);
    printf ("%d employees made salaries between 400 & 499 ", range[2]);
    printf ("%d employees made salaries between 500 & 599 ", range[3]);
    printf ("%d employees made salaries between 600 & 699 ", range[4]);
    printf ("%d employees made salaries between 700 & 799 ", range[5]);
    printf ("%d employees made salaries between 800 & 899 ", range[6]);
    printf ("%d employees made salaries between 900 & 999 ", range[7]);
    printf ("%d employees made salaries over 1000 ", range[8]);

} // Ends main


Log in to post an answer

Answer by dwain on March 29, 2016 8:19 PM

Remove BASE and just use 200.

In the line "if (sa lary >= 600 && salary <= 699){" change to "if (salary >= 600 && salary <= 699){".


COP1220 - Introduction to Programming in C

Functions - Functions in a program


Can anyone help with this please, it is suppose to use a function called distance to return the distance between two points.

This is the original question.

Write a function distance that calculates the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be of type double.


#include <stdio.h>
#include <math.h>

int main (void) {
    
double distance(int p1x, int p1y, int p2x, int p2y); // Function prototype

double x1, x2, y1, y2;

    printf ("Enter x value for first point: ");
    scanf("%f", &x1);
    
    printf ("Enter y value for first point: ");
    scanf("%f", &y1);
    
    printf ("Enter x value for second point: ");
    scanf("%f", &x2);
    
    printf ("Enter y value for second point: ");
    scanf("%f", &y2);
    
    printf ("This is your distance between the two points: %.2f", distance(x1, y1, x2, y2));
    
double distance(double x1, double y1, double x2, double y2) {
    
    return sqrt(pow((x1-x2),2) + pow((y1 - y2),2));
}

} // Ends main


Log in to post an answer

CNT2000 -

Network Models - OSI Model


How many layers does the OSI model contain?


Log in to post an answer

CNT2000 -

Network Models - TCP/IP Model


Which layer of the TCP/IP model is mapped to the top three layers of the OSI model?

A) Layer 1

B) Layer 2

C) Layer 3

D) Layer 4


Log in to post an answer

CNT2000 -

IEEE - Wireless LAN Networks


Which IEEE subcommittee sets the standards for wireless LAN networks?

A) 802.2

B) 802.3

C) 802.5

D) 802.11


Log in to post an answer

CNT2000 -

Topology - Fault Tolerance


Which network topology offers the greatest level of fault tolerance?

A) bus

B) ring

C) star

D) mesh


Log in to post an answer

COP1220 - Introduction to Programming in C

Structures - study guide



Question 9 page 5 - chapter 10 study guide:
Have a question about what the correct solution is and wanted to know what "cin" part means. This is the original question:

Assume two variables p1 and p2 of type POINT, with two fields, x and y, both of type double, have been declared. Write a statement that reads values for p1 and p2 in that order. Assume that values for x always precede y

Solution 1:
cin >> p1.x >> p1.y >> p2.x >> p2.y;

Solution 2:
struct POINT{
double x, y;
};
double a,b,c,d;
cin>>a>>b>>c>>d;
p1.x= a;
p1.y=b;
p2.x= c;
p2.y=d;

Thanks you guys.


Log in to post an answer

Answer by dwain on April 22, 2016 5:39 PM

Hi lucio, I am still trying to locate this question on the study guide, can you email the study guide that you have to me.

For now, I think "cin" here is just a variable that holds a number.

and ">>" is an operater, it is a bitwise operater, get more info on it here bitwise operator.

In that case, I think the answer would be;

scanf ("%lf", &p1.x);

scanf ("%lf", &p1.y);

scanf ("%lf", &p2.x);

scanf ("%lf", &p2.y);


COP1220 - Introduction to Programming in C

Structure - Operation on Structures


Which of the following is not a valid operation on a structure?

A) Assigning structure variables to structure variables of the same type.

B) Taking the address of a structure variable.

C) Using the sizeof operator to determine the size of a structure variable.

D) Comparing structures of the same type with relational operators.


Log in to post an answer

COP1220 - Introduction to Programming in C

Structures - Declaration


How do you declare a structure whose tag name is Server and that contains the following fields: manufacturer, a string, model and serialnum, both also strings, year, an int, clockSpeed, a double, cores, an int , ram, an int  and finally storage an int.


 


Log in to post an answer

Answer by dwain on April 22, 2016 4:01 PM

struct Server {
       string manufacturer, model, serialnum;
       Int year, cores, ram, storage;
       double clockSpeed;
};


COP1220 -

Structures - Member Operator


What is the structure member operator?


Log in to post an answer

Answer by ryan on April 24, 2016 3:31 PM

The dot operator (.) is used as the structure member operator

For example consider a structure variable p1 and a member x, then the correct reference to p1's member is;

p1.x

The above notation says that x is a member of the structure variable p1.


COP1220 -

Functions - Standard In/Out


Which function does not use either the standard input stream or the standard output stream?

A) puts                          

B) getchar

C) gettime

D) scanf


Log in to post an answer

Answer by ryan on May 10, 2016 9:50 PM

Answer is C, gettime


COP1220 -

Functions - Arguments


When all elements of an array is passed as an argument in a function, do you have to include the subscript like "array[50]" or you just say "array"?


Log in to post an answer

COP1220 -

I/O - Streams


What is an input stream in C programming?


Log in to post an answer

COP1220 -

I/O - Streams


What is an output stream in C programming?


Log in to post an answer

COP1220 -

Numbering Systems - Floating Point Numbers


What is the difference between a double and a floating point number?


Log in to post an answer

COP1220 -

Variables - Variable Types


In the statement

char* value = 'hello';

What does the * mean and what does it do?

 

 

 

 

 

 


Log in to post an answer

CNT2000 -

IPv6 - Translate to IPv4


How do you work out this problem?

Given that your MAC address is 00-50-8D-86-0A-07, calculate a link-local address for a non-Windows system.


Log in to post an answer

PHI1010 -

Religion - Term Paper Review


Hi, can anyone help me review my paper to see if its up to par, please include a grade you would give it. Thanks

 

Term Paper: Judaism: explain the significance of the Passover.

“And this day shall be unto you for a memorial; and ye shall keep it a feast to the Lord throughout your generations; ye shall keep it a feast by an ordinance forever.” Exodus 20:14

This feast that the Lord commanded Moses to keep in the scripture above is today called the Passover or Pesach in Hebrew language. It is one of the most important religious festival on the Jewish calendar. The Passover is significant in Judaism as it represents the day God delivered the Israelites from Egyptian slavery. It is significant for a number of reasons, however, in order to fully understand and appreciate this celebration it is important to understand the events that led up to this day. This essay you are reading entails the story of the Passover and reasons attributed to why it is held in such high regards.

 

It is known throughout biblical teaching that the Israelites were God’s chosen people, however, the book of Exodus chronicles the story of how God’s chosen people were in bondage for over four hundred years, enslaved by the Egyptians. The Lord heard their cries and remembered his covenant with Abraham, with Isaacs, and with Jacob, and he appeared unto Moses as a burning flame in the bushes.

 

“And the Lord said, I have surely seen the affliction of my people which are in Egypt, and have heard their cry by reason of their taskmasters. For I know their sorrows, and I come down to deliver them out of the hand of the Egyptians, and to bring them unto a good land flowing with milk and honey.” Exodus 3:7-8. God selected Moses to lead the children of Israel out of bondage. In his quest to free the Israelites, Pharaoh, the ruler of Egypt refused to let them go, and God caused ten plagues to come upon Egypt. God told Moses, “and I will stretch out my hand and smite Egypt with all my wonders which I will do in the midst thereof: and after that he will let you go.” Exodus 3:20.

 

The Lord did as he said, Moses stretched out his rod and he turned the water of the River Nile into blood so causing the fishes to die and the water stank. All the water in Egypt was turned into blood. And Pharaoh still refused to let the people go. So God sent the plague of frogs, and Egypt was overrun with frogs, there were frogs everywhere. Each time Pharaoh refused to free the Israelites another plague was sent. There was the plague of lice, dust was turned into lice which crawled on the people and animals. Then there were the plague flies, swarms of flies covered the land of Egypt. Even so Pharaoh’s heart hardened, and God continued, and all animals belonging to the Egyptians died. The plague of boils was next, festering boils broke out on Egyptians. God sent hailstorm, beating down crops and killing people and animals caught in it. After the hailstorm he sent locusts and it devoured anything left growing after the hailstorm. Egypt was then plunged into darkness for three days by the hand of God. Despite all of these plagues Pharaoh still kept the Israelites enslaved.

 

“And the Lord said unto Moses, yet will I bring one plague more upon Pharaoh, and upon Egypt; afterwards he will let you go hence: when he shall let you go, he shall surely thrust you out hence altogether.” Exodus 11:1.

 

This was the plague of the first born, where the Lord killed every firstborn in every household, from the first born of Pharaoh, to the first born of the maidservant and all the first born of the beasts.

 

            The Passover that is be


Log in to post an answer

PHI1010 -

Religion - Term Paper Review


Hi, can anyone help me review my paper to see if its up to par, please include a grade you would give it. Thanks

 

Term Paper: Judaism: explain the significance of the Passover.

“And this day shall be unto you for a memorial; and ye shall keep it a feast to the Lord throughout your generations; ye shall keep it a feast by an ordinance forever.” Exodus 20:14

This feast that the Lord commanded Moses to keep in the scripture above is today called the Passover or Pesach in Hebrew language. It is one of the most important religious festival on the Jewish calendar. The Passover is significant in Judaism as it represents the day God delivered the Israelites from Egyptian slavery. It is significant for a number of reasons, however, in order to fully understand and appreciate this celebration it is important to understand the events that led up to this day. This essay you are reading entails the story of the Passover and reasons attributed to why it is held in such high regards.

 

It is known throughout biblical teaching that the Israelites were God’s chosen people, however, the book of Exodus chronicles the story of how God’s chosen people were in bondage for over four hundred years, enslaved by the Egyptians. The Lord heard their cries and remembered his covenant with Abraham, with Isaacs, and with Jacob, and he appeared unto Moses as a burning flame in the bushes.

 

“And the Lord said, I have surely seen the affliction of my people which are in Egypt, and have heard their cry by reason of their taskmasters. For I know their sorrows, and I come down to deliver them out of the hand of the Egyptians, and to bring them unto a good land flowing with milk and honey.” Exodus 3:7-8. God selected Moses to lead the children of Israel out of bondage. In his quest to free the Israelites, Pharaoh, the ruler of Egypt refused to let them go, and God caused ten plagues to come upon Egypt. God told Moses, “and I will stretch out my hand and smite Egypt with all my wonders which I will do in the midst thereof: and after that he will let you go.” Exodus 3:20.

 

The Lord did as he said, Moses stretched out his rod and he turned the water of the River Nile into blood so causing the fishes to die and the water stank. All the water in Egypt was turned into blood. And Pharaoh still refused to let the people go. So God sent the plague of frogs, and Egypt was overrun with frogs, there were frogs everywhere. Each time Pharaoh refused to free the Israelites another plague was sent. There was the plague of lice, dust was turned into lice which crawled on the people and animals. Then there were the plague flies, swarms of flies covered the land of Egypt. Even so Pharaoh’s heart hardened, and God continued, and all animals belonging to the Egyptians died. The plague of boils was next, festering boils broke out on Egyptians. God sent hailstorm, beating down crops and killing people and animals caught in it. After the hailstorm he sent locusts and it devoured anything left growing after the hailstorm. Egypt was then plunged into darkness for three days by the hand of God. Despite all of these plagues Pharaoh still kept the Israelites enslaved.

 

“And the Lord said unto Moses, yet will I bring one plague more upon Pharaoh, and upon Egypt; afterwards he will let you go hence: when he shall let you go, he shall surely thrust you out hence altogether.” Exodus 11:1.

 

This was the plague of the first born, where the Lord killed every firstborn in every household, from the first born of Pharaoh, to the first born of the maidservant and all the first born of the beasts.

 

            The Passover that is be


Log in to post an answer

PHI1010 -

Religion - Term Paper Review


Hi, can anyone help me review my paper to see if its up to par, please include a grade you would give it. Thanks

 

Term Paper: Judaism: explain the significance of the Passover.

“And this day shall be unto you for a memorial; and ye shall keep it a feast to the Lord throughout your generations; ye shall keep it a feast by an ordinance forever.” Exodus 20:14

This feast that the Lord commanded Moses to keep in the scripture above is today called the Passover or Pesach in Hebrew language. It is one of the most important religious festival on the Jewish calendar. The Passover is significant in Judaism as it represents the day God delivered the Israelites from Egyptian slavery. It is significant for a number of reasons, however, in order to fully understand and appreciate this celebration it is important to understand the events that led up to this day. This essay you are reading entails the story of the Passover and reasons attributed to why it is held in such high regards.

 

It is known throughout biblical teaching that the Israelites were God’s chosen people, however, the book of Exodus chronicles the story of how God’s chosen people were in bondage for over four hundred years, enslaved by the Egyptians. The Lord heard their cries and remembered his covenant with Abraham, with Isaacs, and with Jacob, and he appeared unto Moses as a burning flame in the bushes.

 

“And the Lord said, I have surely seen the affliction of my people which are in Egypt, and have heard their cry by reason of their taskmasters. For I know their sorrows, and I come down to deliver them out of the hand of the Egyptians, and to bring them unto a good land flowing with milk and honey.” Exodus 3:7-8. God selected Moses to lead the children of Israel out of bondage. In his quest to free the Israelites, Pharaoh, the ruler of Egypt refused to let them go, and God caused ten plagues to come upon Egypt. God told Moses, “and I will stretch out my hand and smite Egypt with all my wonders which I will do in the midst thereof: and after that he will let you go.” Exodus 3:20.

 

The Lord did as he said, Moses stretched out his rod and he turned the water of the River Nile into blood so causing the fishes to die and the water stank. All the water in Egypt was turned into blood. And Pharaoh still refused to let the people go. So God sent the plague of frogs, and Egypt was overrun with frogs, there were frogs everywhere. Each time Pharaoh refused to free the Israelites another plague was sent. There was the plague of lice, dust was turned into lice which crawled on the people and animals. Then there were the plague flies, swarms of flies covered the land of Egypt. Even so Pharaoh’s heart hardened, and God continued, and all animals belonging to the Egyptians died. The plague of boils was next, festering boils broke out on Egyptians. God sent hailstorm, beating down crops and killing people and animals caught in it. After the hailstorm he sent locusts and it devoured anything left growing after the hailstorm. Egypt was then plunged into darkness for three days by the hand of God. Despite all of these plagues Pharaoh still kept the Israelites enslaved.

 

“And the Lord said unto Moses, yet will I bring one plague more upon Pharaoh, and upon Egypt; afterwards he will let you go hence: when he shall let you go, he shall surely thrust you out hence altogether.” Exodus 11:1.

 

This was the plague of the first born, where the Lord killed every firstborn in every household, from the first born of Pharaoh, to the first born of the maidservant and all the first born of the beasts.

 

            The Passover that is be


Log in to post an answer

PHI1010 -

Religion - Term Paper Review


Hi, can anyone help me review my paper to see if its up to par, please include a grade you would give it. Thanks

 

Term Paper: Judaism: explain the significance of the Passover.

“And this day shall be unto you for a memorial; and ye shall keep it a feast to the Lord throughout your generations; ye shall keep it a feast by an ordinance forever.” Exodus 20:14

This feast that the Lord commanded Moses to keep in the scripture above is today called the Passover or Pesach in Hebrew language. It is one of the most important religious festival on the Jewish calendar. The Passover is significant in Judaism as it represents the day God delivered the Israelites from Egyptian slavery. It is significant for a number of reasons, however, in order to fully understand and appreciate this celebration it is important to understand the events that led up to this day. This essay you are reading entails the story of the Passover and reasons attributed to why it is held in such high regards.

 

It is known throughout biblical teaching that the Israelites were God’s chosen people, however, the book of Exodus chronicles the story of how God’s chosen people were in bondage for over four hundred years, enslaved by the Egyptians. The Lord heard their cries and remembered his covenant with Abraham, with Isaacs, and with Jacob, and he appeared unto Moses as a burning flame in the bushes.

 

“And the Lord said, I have surely seen the affliction of my people which are in Egypt, and have heard their cry by reason of their taskmasters. For I know their sorrows, and I come down to deliver them out of the hand of the Egyptians, and to bring them unto a good land flowing with milk and honey.” Exodus 3:7-8. God selected Moses to lead the children of Israel out of bondage. In his quest to free the Israelites, Pharaoh, the ruler of Egypt refused to let them go, and God caused ten plagues to come upon Egypt. God told Moses, “and I will stretch out my hand and smite Egypt with all my wonders which I will do in the midst thereof: and after that he will let you go.” Exodus 3:20.

 

The Lord did as he said, Moses stretched out his rod and he turned the water of the River Nile into blood so causing the fishes to die and the water stank. All the water in Egypt was turned into blood. And Pharaoh still refused to let the people go. So God sent the plague of frogs, and Egypt was overrun with frogs, there were frogs everywhere. Each time Pharaoh refused to free the Israelites another plague was sent. There was the plague of lice, dust was turned into lice which crawled on the people and animals. Then there were the plague flies, swarms of flies covered the land of Egypt. Even so Pharaoh’s heart hardened, and God continued, and all animals belonging to the Egyptians died. The plague of boils was next, festering boils broke out on Egyptians. God sent hailstorm, beating down crops and killing people and animals caught in it. After the hailstorm he sent locusts and it devoured anything left growing after the hailstorm. Egypt was then plunged into darkness for three days by the hand of God. Despite all of these plagues Pharaoh still kept the Israelites enslaved.

 

“And the Lord said unto Moses, yet will I bring one plague more upon Pharaoh, and upon Egypt; afterwards he will let you go hence: when he shall let you go, he shall surely thrust you out hence altogether.” Exodus 11:1.

 

This was the plague of the first born, where the Lord killed every firstborn in every household, from the first born of Pharaoh, to the first born of the maidservant and all the first born of the beasts.

 

            The Passover that is be


Log in to post an answer

PHI1010 -

Religion - Term Paper Review


Hi, can anyone help me review my paper to see if its up to par, please include a grade you would give it. Thanks

 

Term Paper: Judaism: explain the significance of the Passover.

“And this day shall be unto you for a memorial; and ye shall keep it a feast to the Lord throughout your generations; ye shall keep it a feast by an ordinance forever.” Exodus 20:14

This feast that the Lord commanded Moses to keep in the scripture above is today called the Passover or Pesach in Hebrew language. It is one of the most important religious festival on the Jewish calendar. The Passover is significant in Judaism as it represents the day God delivered the Israelites from Egyptian slavery. It is significant for a number of reasons, however, in order to fully understand and appreciate this celebration it is important to understand the events that led up to this day. This essay you are reading entails the story of the Passover and reasons attributed to why it is held in such high regards.

 

It is known throughout biblical teaching that the Israelites were God’s chosen people, however, the book of Exodus chronicles the story of how God’s chosen people were in bondage for over four hundred years, enslaved by the Egyptians. The Lord heard their cries and remembered his covenant with Abraham, with Isaacs, and with Jacob, and he appeared unto Moses as a burning flame in the bushes.

 

“And the Lord said, I have surely seen the affliction of my people which are in Egypt, and have heard their cry by reason of their taskmasters. For I know their sorrows, and I come down to deliver them out of the hand of the Egyptians, and to bring them unto a good land flowing with milk and honey.” Exodus 3:7-8. God selected Moses to lead the children of Israel out of bondage. In his quest to free the Israelites, Pharaoh, the ruler of Egypt refused to let them go, and God caused ten plagues to come upon Egypt. God told Moses, “and I will stretch out my hand and smite Egypt with all my wonders which I will do in the midst thereof: and after that he will let you go.” Exodus 3:20.

 

The Lord did as he said, Moses stretched out his rod and he turned the water of the River Nile into blood so causing the fishes to die and the water stank. All the water in Egypt was turned into blood. And Pharaoh still refused to let the people go. So God sent the plague of frogs, and Egypt was overrun with frogs, there were frogs everywhere. Each time Pharaoh refused to free the Israelites another plague was sent. There was the plague of lice, dust was turned into lice which crawled on the people and animals. Then there were the plague flies, swarms of flies covered the land of Egypt. Even so Pharaoh’s heart hardened, and God continued, and all animals belonging to the Egyptians died. The plague of boils was next, festering boils broke out on Egyptians. God sent hailstorm, beating down crops and killing people and animals caught in it. After the hailstorm he sent locusts and it devoured anything left growing after the hailstorm. Egypt was then plunged into darkness for three days by the hand of God. Despite all of these plagues Pharaoh still kept the Israelites enslaved.

 

“And the Lord said unto Moses, yet will I bring one plague more upon Pharaoh, and upon Egypt; afterwards he will let you go hence: when he shall let you go, he shall surely thrust you out hence altogether.” Exodus 11:1.

 

This was the plague of the first born, where the Lord killed every firstborn in every household, from the first born of Pharaoh, to the first born of the maidservant and all the first born of the beasts.

 

            The Passover that is be


Log in to post an answer

PHI1010 -

Religion - Term Paper Review


Hi, can anyone help me review my paper to see if its up to par, please include a grade you would give it. Thanks

 

Term Paper: Judaism: explain the significance of the Passover.

“And this day shall be unto you for a memorial; and ye shall keep it a feast to the Lord throughout your generations; ye shall keep it a feast by an ordinance forever.” Exodus 20:14

This feast that the Lord commanded Moses to keep in the scripture above is today called the Passover or Pesach in Hebrew language. It is one of the most important religious festival on the Jewish calendar. The Passover is significant in Judaism as it represents the day God delivered the Israelites from Egyptian slavery. It is significant for a number of reasons, however, in order to fully understand and appreciate this celebration it is important to understand the events that led up to this day. This essay you are reading entails the story of the Passover and reasons attributed to why it is held in such high regards.

 

It is known throughout biblical teaching that the Israelites were God’s chosen people, however, the book of Exodus chronicles the story of how God’s chosen people were in bondage for over four hundred years, enslaved by the Egyptians. The Lord heard their cries and remembered his covenant with Abraham, with Isaacs, and with Jacob, and he appeared unto Moses as a burning flame in the bushes.

 

“And the Lord said, I have surely seen the affliction of my people which are in Egypt, and have heard their cry by reason of their taskmasters. For I know their sorrows, and I come down to deliver them out of the hand of the Egyptians, and to bring them unto a good land flowing with milk and honey.” Exodus 3:7-8. God selected Moses to lead the children of Israel out of bondage. In his quest to free the Israelites, Pharaoh, the ruler of Egypt refused to let them go, and God caused ten plagues to come upon Egypt. God told Moses, “and I will stretch out my hand and smite Egypt with all my wonders which I will do in the midst thereof: and after that he will let you go.” Exodus 3:20.

 

The Lord did as he said, Moses stretched out his rod and he turned the water of the River Nile into blood so causing the fishes to die and the water stank. All the water in Egypt was turned into blood. And Pharaoh still refused to let the people go. So God sent the plague of frogs, and Egypt was overrun with frogs, there were frogs everywhere. Each time Pharaoh refused to free the Israelites another plague was sent. There was the plague of lice, dust was turned into lice which crawled on the people and animals. Then there were the plague flies, swarms of flies covered the land of Egypt. Even so Pharaoh’s heart hardened, and God continued, and all animals belonging to the Egyptians died. The plague of boils was next, festering boils broke out on Egyptians. God sent hailstorm, beating down crops and killing people and animals caught in it. After the hailstorm he sent locusts and it devoured anything left growing after the hailstorm. Egypt was then plunged into darkness for three days by the hand of God. Despite all of these plagues Pharaoh still kept the Israelites enslaved.

 

“And the Lord said unto Moses, yet will I bring one plague more upon Pharaoh, and upon Egypt; afterwards he will let you go hence: when he shall let you go, he shall surely thrust you out hence altogether.” Exodus 11:1.

 

This was the plague of the first born, where the Lord killed every firstborn in every household, from the first born of Pharaoh, to the first born of the maidservant and all the first born of the beasts.

 

            The Passover that is be


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

COP1220 -

Structures - Declaration


How do I declare a structure whose name is "Money" and that contains exactly two in fields "dollars" and "cents"?


Log in to post an answer

Math -

-


What is the next number in the sequence?

2, 4, 6, 12, 14, ?


Log in to post an answer

CNT2000 -

OSI Model - MAC Address


How long is a MAC address?

A. 12 hexadecimal characters

B. 48 bytes

C. 12 bytes

D. 32 bytes


Log in to post an answer

CNT2000 -

OSI Model - MAC Address


Which of the following is another name for a MAC address?

A. physical

B. logical

C. IP

D. computer


Log in to post an answer

COP1220 -

Arrays - Definition


Arrays are data structures consisting of related data items of the same __________.

a) sort order

b) subscript

c) type

d) element


Log in to post an answer

COP1220 -

C - program


write a program that calculates the squares and cubes of the numbers from 0 to 10 and uses tabs to print the following table of values:

Program output should look like;

0        0        0

1        1        1

2        4        8

3        9       27

4       16      64

5       25      125

6       36      216

7       49      343

8       64      512

9       81      729

10     100    1000


Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

COP1220 -

C - program


Research several car-pooling websites. Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by car pooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work:

  • a)  Total miles driven per day. 

  • b)  Costpergallonofgasoline. 

  • c)  Average miles per gallon. 

  • d)  Parkingfeesperday. 

  • e)  Tolls per day. 



Log in to post an answer

MAC2311 -

Algebra - Review


What is the slope of a line with the two points (1, 4) and (5, 6).


Log in to post an answer

-

-


3.9 (Business: check ISBN-10) 
An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. 
The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11
If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. 
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. 
Here are sample runs:
Enter the first 9 digits of an ISBN as integer: 013601267 
The ISBN-10 number is 0136012671
Enter the first 9 digits of an ISBN as integer: 013031997 
The ISBN-10 number is 013031997X

// using 9 digits as a string
// this code has logical errors

import java.util.Scanner;
public class ISBN10 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
String isbn = input.nextLine();


int sum = 0, i = 0; // i represents each of the 9 digits

while (i < 9) { 

char intChar = isbn.charAt(i); 

int digit = intChar * (i + 1); // this may be the calc. issue location

sum = sum + digit; 

i = i + 1; 

int checkSum = (sum % 11); 
if (checkSum == 10) 
System.out.println("The ISBN-10 number is " + isbn + "X"); 
else 
System.out.println("The ISBN-10 number is " + isbn + checkSum);

System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
}}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X)

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  


Log in to post an answer

Answer by dwain on September 11, 2016 11:55 AM

This code works properly Lucio, 013031997 produces a 3 after you run it through the formula.

An example of a number that produces a 10 is 062031997, therefore will give you an X at the end of the ISBN.

I refactored the code with proper indenting and closed the scanner input. The new code is listed below.

package Ex3dot9;

//using 9 digits as a string
//this code has logical errors

import java.util.Scanner;

public class ISBN {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the first 9 digits of an ISBN as integer: ");
        String isbn = input.nextLine();

        int sum = 0, i = 0; // i represents each of the 9 digits

        while (i < 9) {

            char intChar = isbn.charAt(i);

            int digit = intChar * (i + 1); // this may be the calc. issue location

            sum = sum + digit;

            i = i + 1;
        }

        int checkSum = (sum % 11);
        
        if (checkSum == 10)
            System.out.println("The ISBN-10 number is " + isbn + "X");
        else
            System.out.println("The ISBN-10 number is " + isbn + checkSum);

            System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
            System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
    
            input.close(); // Added to close the scanner input
    }
}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X) <-- This part is wrong, when you run 013031997 through the formula the answer is 3

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  

 


-

-


3.9 (Business: check ISBN-10) 
An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. 
The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11
If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. 
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. 
Here are sample runs:
Enter the first 9 digits of an ISBN as integer: 013601267 
The ISBN-10 number is 0136012671
Enter the first 9 digits of an ISBN as integer: 013031997 
The ISBN-10 number is 013031997X

// using 9 digits as a string
// this code has logical errors

import java.util.Scanner;
public class ISBN10 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
String isbn = input.nextLine();


int sum = 0, i = 0; // i represents each of the 9 digits

while (i < 9) { 

char intChar = isbn.charAt(i); 

int digit = intChar * (i + 1); // this may be the calc. issue location

sum = sum + digit; 

i = i + 1; 

int checkSum = (sum % 11); 
if (checkSum == 10) 
System.out.println("The ISBN-10 number is " + isbn + "X"); 
else 
System.out.println("The ISBN-10 number is " + isbn + checkSum);

System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
}}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X)

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  


Log in to post an answer

Answer by dwain on September 11, 2016 11:55 AM

This code works properly Lucio, 013031997 produces a 3 after you run it through the formula.

An example of a number that produces a 10 is 062031997, therefore will give you an X at the end of the ISBN.

I refactored the code with proper indenting and closed the scanner input. The new code is listed below.

package Ex3dot9;

//using 9 digits as a string
//this code has logical errors

import java.util.Scanner;

public class ISBN {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the first 9 digits of an ISBN as integer: ");
        String isbn = input.nextLine();

        int sum = 0, i = 0; // i represents each of the 9 digits

        while (i < 9) {

            char intChar = isbn.charAt(i);

            int digit = intChar * (i + 1); // this may be the calc. issue location

            sum = sum + digit;

            i = i + 1;
        }

        int checkSum = (sum % 11);
        
        if (checkSum == 10)
            System.out.println("The ISBN-10 number is " + isbn + "X");
        else
            System.out.println("The ISBN-10 number is " + isbn + checkSum);

            System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
            System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
    
            input.close(); // Added to close the scanner input
    }
}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X) <-- This part is wrong, when you run 013031997 through the formula the answer is 3

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  

 


-

-


3.9 (Business: check ISBN-10) 
An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. 
The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11
If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. 
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. 
Here are sample runs:
Enter the first 9 digits of an ISBN as integer: 013601267 
The ISBN-10 number is 0136012671
Enter the first 9 digits of an ISBN as integer: 013031997 
The ISBN-10 number is 013031997X

// using 9 digits as a string
// this code has logical errors

import java.util.Scanner;
public class ISBN10 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
String isbn = input.nextLine();


int sum = 0, i = 0; // i represents each of the 9 digits

while (i < 9) { 

char intChar = isbn.charAt(i); 

int digit = intChar * (i + 1); // this may be the calc. issue location

sum = sum + digit; 

i = i + 1; 

int checkSum = (sum % 11); 
if (checkSum == 10) 
System.out.println("The ISBN-10 number is " + isbn + "X"); 
else 
System.out.println("The ISBN-10 number is " + isbn + checkSum);

System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
}}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X)

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  


Log in to post an answer

Answer by dwain on September 11, 2016 11:55 AM

This code works properly Lucio, 013031997 produces a 3 after you run it through the formula.

An example of a number that produces a 10 is 062031997, therefore will give you an X at the end of the ISBN.

I refactored the code with proper indenting and closed the scanner input. The new code is listed below.

package Ex3dot9;

//using 9 digits as a string
//this code has logical errors

import java.util.Scanner;

public class ISBN {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the first 9 digits of an ISBN as integer: ");
        String isbn = input.nextLine();

        int sum = 0, i = 0; // i represents each of the 9 digits

        while (i < 9) {

            char intChar = isbn.charAt(i);

            int digit = intChar * (i + 1); // this may be the calc. issue location

            sum = sum + digit;

            i = i + 1;
        }

        int checkSum = (sum % 11);
        
        if (checkSum == 10)
            System.out.println("The ISBN-10 number is " + isbn + "X");
        else
            System.out.println("The ISBN-10 number is " + isbn + checkSum);

            System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
            System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
    
            input.close(); // Added to close the scanner input
    }
}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X) <-- This part is wrong, when you run 013031997 through the formula the answer is 3

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  

 


-

-


3.9 (Business: check ISBN-10) 
An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. 
The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11
If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. 
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. 
Here are sample runs:
Enter the first 9 digits of an ISBN as integer: 013601267 
The ISBN-10 number is 0136012671
Enter the first 9 digits of an ISBN as integer: 013031997 
The ISBN-10 number is 013031997X

// using 9 digits as a string
// this code has logical errors

import java.util.Scanner;
public class ISBN10 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
String isbn = input.nextLine();


int sum = 0, i = 0; // i represents each of the 9 digits

while (i < 9) { 

char intChar = isbn.charAt(i); 

int digit = intChar * (i + 1); // this may be the calc. issue location

sum = sum + digit; 

i = i + 1; 

int checkSum = (sum % 11); 
if (checkSum == 10) 
System.out.println("The ISBN-10 number is " + isbn + "X"); 
else 
System.out.println("The ISBN-10 number is " + isbn + checkSum);

System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
}}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X)

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  


Log in to post an answer

Answer by dwain on September 11, 2016 11:55 AM

This code works properly Lucio, 013031997 produces a 3 after you run it through the formula.

An example of a number that produces a 10 is 062031997, therefore will give you an X at the end of the ISBN.

I refactored the code with proper indenting and closed the scanner input. The new code is listed below.

package Ex3dot9;

//using 9 digits as a string
//this code has logical errors

import java.util.Scanner;

public class ISBN {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the first 9 digits of an ISBN as integer: ");
        String isbn = input.nextLine();

        int sum = 0, i = 0; // i represents each of the 9 digits

        while (i < 9) {

            char intChar = isbn.charAt(i);

            int digit = intChar * (i + 1); // this may be the calc. issue location

            sum = sum + digit;

            i = i + 1;
        }

        int checkSum = (sum % 11);
        
        if (checkSum == 10)
            System.out.println("The ISBN-10 number is " + isbn + "X");
        else
            System.out.println("The ISBN-10 number is " + isbn + checkSum);

            System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
            System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
    
            input.close(); // Added to close the scanner input
    }
}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X) <-- This part is wrong, when you run 013031997 through the formula the answer is 3

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  

 


-

-


3.9 (Business: check ISBN-10) 
An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. 
The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11
If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. 
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. 
Here are sample runs:
Enter the first 9 digits of an ISBN as integer: 013601267 
The ISBN-10 number is 0136012671
Enter the first 9 digits of an ISBN as integer: 013031997 
The ISBN-10 number is 013031997X

// using 9 digits as a string
// this code has logical errors

import java.util.Scanner;
public class ISBN10 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
String isbn = input.nextLine();


int sum = 0, i = 0; // i represents each of the 9 digits

while (i < 9) { 

char intChar = isbn.charAt(i); 

int digit = intChar * (i + 1); // this may be the calc. issue location

sum = sum + digit; 

i = i + 1; 

int checkSum = (sum % 11); 
if (checkSum == 10) 
System.out.println("The ISBN-10 number is " + isbn + "X"); 
else 
System.out.println("The ISBN-10 number is " + isbn + checkSum);

System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
}}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X)

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  


Log in to post an answer

Answer by dwain on September 11, 2016 11:55 AM

This code works properly Lucio, 013031997 produces a 3 after you run it through the formula.

An example of a number that produces a 10 is 062031997, therefore will give you an X at the end of the ISBN.

I refactored the code with proper indenting and closed the scanner input. The new code is listed below.

package Ex3dot9;

//using 9 digits as a string
//this code has logical errors

import java.util.Scanner;

public class ISBN {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the first 9 digits of an ISBN as integer: ");
        String isbn = input.nextLine();

        int sum = 0, i = 0; // i represents each of the 9 digits

        while (i < 9) {

            char intChar = isbn.charAt(i);

            int digit = intChar * (i + 1); // this may be the calc. issue location

            sum = sum + digit;

            i = i + 1;
        }

        int checkSum = (sum % 11);
        
        if (checkSum == 10)
            System.out.println("The ISBN-10 number is " + isbn + "X");
        else
            System.out.println("The ISBN-10 number is " + isbn + checkSum);

            System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
            System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
    
            input.close(); // Added to close the scanner input
    }
}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X) <-- This part is wrong, when you run 013031997 through the formula the answer is 3

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  

 


-

-


3.9 (Business: check ISBN-10) 
An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. 
The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11
If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. 
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. 
Here are sample runs:
Enter the first 9 digits of an ISBN as integer: 013601267 
The ISBN-10 number is 0136012671
Enter the first 9 digits of an ISBN as integer: 013031997 
The ISBN-10 number is 013031997X

// using 9 digits as a string
// this code has logical errors

import java.util.Scanner;
public class ISBN10 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
String isbn = input.nextLine();


int sum = 0, i = 0; // i represents each of the 9 digits

while (i < 9) { 

char intChar = isbn.charAt(i); 

int digit = intChar * (i + 1); // this may be the calc. issue location

sum = sum + digit; 

i = i + 1; 

int checkSum = (sum % 11); 
if (checkSum == 10) 
System.out.println("The ISBN-10 number is " + isbn + "X"); 
else 
System.out.println("The ISBN-10 number is " + isbn + checkSum);

System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
}}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X)

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  


Log in to post an answer

Answer by dwain on September 11, 2016 11:55 AM

This code works properly Lucio, 013031997 produces a 3 after you run it through the formula.

An example of a number that produces a 10 is 062031997, therefore will give you an X at the end of the ISBN.

I refactored the code with proper indenting and closed the scanner input. The new code is listed below.

package Ex3dot9;

//using 9 digits as a string
//this code has logical errors

import java.util.Scanner;

public class ISBN {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the first 9 digits of an ISBN as integer: ");
        String isbn = input.nextLine();

        int sum = 0, i = 0; // i represents each of the 9 digits

        while (i < 9) {

            char intChar = isbn.charAt(i);

            int digit = intChar * (i + 1); // this may be the calc. issue location

            sum = sum + digit;

            i = i + 1;
        }

        int checkSum = (sum % 11);
        
        if (checkSum == 10)
            System.out.println("The ISBN-10 number is " + isbn + "X");
        else
            System.out.println("The ISBN-10 number is " + isbn + checkSum);

            System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
            System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
    
            input.close(); // Added to close the scanner input
    }
}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X) <-- This part is wrong, when you run 013031997 through the formula the answer is 3

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  

 


-

-


3.9 (Business: check ISBN-10) 
An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. 
The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula:
(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11
If the checksum is 10, the last digit is denoted as X according to the ISBN-10 convention. 
Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer. 
Here are sample runs:
Enter the first 9 digits of an ISBN as integer: 013601267 
The ISBN-10 number is 0136012671
Enter the first 9 digits of an ISBN as integer: 013031997 
The ISBN-10 number is 013031997X

// using 9 digits as a string
// this code has logical errors

import java.util.Scanner;
public class ISBN10 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the first 9 digits of an ISBN as integer: ");
String isbn = input.nextLine();


int sum = 0, i = 0; // i represents each of the 9 digits

while (i < 9) { 

char intChar = isbn.charAt(i); 

int digit = intChar * (i + 1); // this may be the calc. issue location

sum = sum + digit; 

i = i + 1; 

int checkSum = (sum % 11); 
if (checkSum == 10) 
System.out.println("The ISBN-10 number is " + isbn + "X"); 
else 
System.out.println("The ISBN-10 number is " + isbn + checkSum);

System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
}}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X)

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  


Log in to post an answer

Answer by dwain on September 11, 2016 11:55 AM

This code works properly Lucio, 013031997 produces a 3 after you run it through the formula.

An example of a number that produces a 10 is 062031997, therefore will give you an X at the end of the ISBN.

I refactored the code with proper indenting and closed the scanner input. The new code is listed below.

package Ex3dot9;

//using 9 digits as a string
//this code has logical errors

import java.util.Scanner;

public class ISBN {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the first 9 digits of an ISBN as integer: ");
        String isbn = input.nextLine();

        int sum = 0, i = 0; // i represents each of the 9 digits

        while (i < 9) {

            char intChar = isbn.charAt(i);

            int digit = intChar * (i + 1); // this may be the calc. issue location

            sum = sum + digit;

            i = i + 1;
        }

        int checkSum = (sum % 11);
        
        if (checkSum == 10)
            System.out.println("The ISBN-10 number is " + isbn + "X");
        else
            System.out.println("The ISBN-10 number is " + isbn + checkSum);

            System.out.println(" the sum of d1*1+...etc is:  "  + sum); // show sum that's going on behind scene
            System.out.println("the sum % 11 is: " + sum % 11); // confirm remainder
    
            input.close(); // Added to close the scanner input
    }
}

/**output:
Enter the first 9 digits of an ISBN as integer: 013031997
The ISBN-10 number is 0130319973 (should be 013031997X) <-- This part is wrong, when you run 013031997 through the formula the answer is 3

the sum of d1*1+...etc is:  2390
the sum % 11 is: 3
*/  

 


COP1220 -

Web Technologies - After Procedural PHP


Hey guys got a quick question. In my early days of web development I've learnt HTML, CSS, Javascript, JQuery, AJAX. I use PHP mostly in a procedural way, I use MySQL for a database. I write my code in Sublime text and "painstakingly" upload it to a hosting company using a FTP client. I develop using the XAMPP local environtment. I was introduced to Git(could learn it some more though).

I want to know which 1, only 1 of the items below to learn nex?

  1. MVC ( Model, View, Control)
  2. Object Oriented PHP
  3. A web Framework (Laravel, Symfony)
  4. Linux Apache Server

Thanks in advance for your recommendations.


Log in to post an answer

COP1220 -

Web Technologies - After Procedural PHP


Hey guys got a quick question. In my early days of web development I've learnt HTML, CSS, Javascript, JQuery, AJAX. I use PHP mostly in a procedural way, I use MySQL for a database. I write my code in Sublime text and "painstakingly" upload it to a hosting company using a FTP client. I develop using the XAMPP local environtment. I was introduced to Git(could learn it some more though).

I want to know which 1, only 1 of the items below to learn nex?

  1. MVC ( Model, View, Control)
  2. Object Oriented PHP
  3. A web Framework (Laravel, Symfony)
  4. Linux Apache Server

Thanks in advance for your recommendations.


Log in to post an answer

COP2800 -

Array - Methods


how to fix the random character code? im getting this output:
Compilation Errors Detected  Line: 31
cannot find symbol
  symbol:   variable RandomCharacter
  location: class CountLettersInArray

Your help is appreciated.

 

public class CountLettersInArray {

// Main method 
public static void main(String[] args) {

// Declare and create an array
char[] chars = createArray();

// Display the array
System.out.println("The lowercase letters are:");
displayArray(chars);

// Count the occurrences of each letter
int[] counts = countLetters(chars);

// Display counts
System.out.println();
System.out.println("The occurrences of each letter are:");
displayCounts(counts);
}

// Create an array of characters 
public static char[] createArray() {

// Declare an array of characters and create it
char[] chars = new char[100];

// Create lowercase letters randomly and assign
// them to the array
for (int i = 0; i < chars.length; i++)
chars[i] = RandomCharacter.getRandomLowerCaseLetter();

// Return the array
return chars;
}

// Display the array of characters 
public static void displayArray(char[] chars) {

// Display the characters in the array 20 on each line
for (int i = 0; i < chars.length; i++) {
if ((i + 1) % 20 == 0)
System.out.println(chars[i]);
else
System.out.print(chars[i] + " ");
}
}

// Count the occurrences of each letter 
public static int[] countLetters(char[] chars) {

// Declare and create an array of 26 int
int[] counts = new int[26];

// For each lowercase letter in the array, count it
for (int i = 0; i < chars.length; i++)
counts[chars[i] - 'a']++;

return counts;
}

// Display counts 
public static void displayCounts(int[] counts) {
for (int i = 0; i < counts.length; i++) {
if ((i + 1) % 10 == 0)
System.out.println(counts[i] + " " + (char)(i + 'a'));
else
System.out.print(counts[i] + " " + (char)(i + 'a') + " ");
}
}
}


Log in to post an answer

Answer by dwain on October 20, 2016 6:34 PM

Hey Lucio I was looking at your code here, you stated you got the error

cannot find symbol
  symbol:   variable RandomCharacter

Fro what I understand here is that your code is trying to invoke the method getRandomLowerCaseLetter() on RandomCharacter. So RandomCharacter has to be an object or a variable, I am thinking more like its an object. But no where have you instantiated(declared) that object.

So for the code to work you have to instantiate RandomCharacter


MAC2311 -

Extrema - Critical Numbers


How do I find the derivative of y = 3 cosx


Log in to post an answer

COP2800 -

-


Hi Dwain, i was putting together this code with hierarchy/inheritance and keep getting compiler errors as shown below.

Any idea on how to get the code printed? Your help is truly appreciated.

 

/*compiler error:
Line: 29 - (package1 new package)
non-static variable this cannot be referenced from a static context
Line: 47 - (package2 new twodaypackage)
non-static variable this cannot be referenced from a static context
Line: 65 - (package3 new overnightpackage)
non-static variable this cannot be referenced from a static context*/

/*TestPackage.java
In this program we're creating an inheritance hierarchy to represent 
various types of packages and their costs. Package is the base class, 
TwoDayPackage and OvernightPackage are inherited from this base class.
These classes use the packages' weight in ounces and shipping fee to 
determine the total cost of the shipping. TwoDayPackage and 
OvernightPackage include extra fees that add to the total cost.*/

import java.text.NumberFormat;
class TestPackage{
public static void main(String[] args) {

//formatter I'm using to display costs in dollars.
 NumberFormat dollar = NumberFormat.getCurrencyInstance();

//describing the number used for my rates.
 System.out.println("Item's weight 5 oz, shipping fee 0.75/oz," +
   "the flat fee $3, the overnight rate $1 per oz.");
   
//creates an object called package1 out of the base class Package
 Package package1 = new Package( 
 "Lou Brown",   "1 Main St", "Boston",   "MA", "11111", 
  "Mary Smith", "7 Elm St",  "New York", "NY", "22222",
  5, .75);

//uses calculateCost method from the base class to get total cost 
 package1.calculateCost(package1.weight, package1.costPerOunce);

//displays parameters of the object and total value from calculateCost method.
 System.out.println("Package 1: Sender: " +package1.senderName + 
   " "  + package1.senderAddress+ " " + package1.senderCity+", " +
   package1.senderState +" " + package1.senderZIP);
 System.out.println(" Recipient: " +package1.recipientName + " "
   + package1.recipientAddress+ " " + package1.recipientCity+", " 
   +package1.recipientState+ " " + package1.recipientZIP + " Cost: " 
   + dollar.format(package1.totalCost) +" ");         

//creates an object called package2 out of the inherited class TwoDayPackage
 TwoDayPackage package2 = new TwoDayPackage(
   "Lisa Klein", "5 Broadway", "Somerville", "MA", "33333",
   "Bob George", "21 Pine Rd", "Cambridge",  "MA", "44444",
   5, .75, 3);

//overridden calculateCost method includes flat fee from TwoDayPackage class.
 package2.calculateCost(package2.weight, package2.costPerOunce);

//displays this object.
 System.out.println("Package 2: Sender: " +package2.senderName + " "
   + package2.senderAddress+ " " + package2.senderCity+", " + 
   package2.senderState + " " + package2.senderZIP);
 System.out.println(" Recipient: " +package2.recipi


Log in to post an answer

COP2800 -

-


Hi Dwain, i was putting together this code with hierarchy/inheritance and keep getting compiler errors as shown below.

Any idea on how to get the code printed? Your help is truly appreciated.

 

/*compiler error:
Line: 29 - (package1 new package)
non-static variable this cannot be referenced from a static context
Line: 47 - (package2 new twodaypackage)
non-static variable this cannot be referenced from a static context
Line: 65 - (package3 new overnightpackage)
non-static variable this cannot be referenced from a static context*/

/*TestPackage.java
In this program we're creating an inheritance hierarchy to represent 
various types of packages and their costs. Package is the base class, 
TwoDayPackage and OvernightPackage are inherited from this base class.
These classes use the packages' weight in ounces and shipping fee to 
determine the total cost of the shipping. TwoDayPackage and 
OvernightPackage include extra fees that add to the total cost.*/

import java.text.NumberFormat;
class TestPackage{
public static void main(String[] args) {

//formatter I'm using to display costs in dollars.
 NumberFormat dollar = NumberFormat.getCurrencyInstance();

//describing the number used for my rates.
 System.out.println("Item's weight 5 oz, shipping fee 0.75/oz," +
   "the flat fee $3, the overnight rate $1 per oz.");
   
//creates an object called package1 out of the base class Package
 Package package1 = new Package( 
 "Lou Brown",   "1 Main St", "Boston",   "MA", "11111", 
  "Mary Smith", "7 Elm St",  "New York", "NY", "22222",
  5, .75);

//uses calculateCost method from the base class to get total cost 
 package1.calculateCost(package1.weight, package1.costPerOunce);

//displays parameters of the object and total value from calculateCost method.
 System.out.println("Package 1: Sender: " +package1.senderName + 
   " "  + package1.senderAddress+ " " + package1.senderCity+", " +
   package1.senderState +" " + package1.senderZIP);
 System.out.println(" Recipient: " +package1.recipientName + " "
   + package1.recipientAddress+ " " + package1.recipientCity+", " 
   +package1.recipientState+ " " + package1.recipientZIP + " Cost: " 
   + dollar.format(package1.totalCost) +" ");         

//creates an object called package2 out of the inherited class TwoDayPackage
 TwoDayPackage package2 = new TwoDayPackage(
   "Lisa Klein", "5 Broadway", "Somerville", "MA", "33333",
   "Bob George", "21 Pine Rd", "Cambridge",  "MA", "44444",
   5, .75, 3);

//overridden calculateCost method includes flat fee from TwoDayPackage class.
 package2.calculateCost(package2.weight, package2.costPerOunce);

//displays this object.
 System.out.println("Package 2: Sender: " +package2.senderName + " "
   + package2.senderAddress+ " " + package2.senderCity+", " + 
   package2.senderState + " " + package2.senderZIP);
 System.out.println(" Recipient: " +package2.recipi


Log in to post an answer

Answer by lucio on November 14, 2016 8:39 AM

i got it now, it's just a matter of being more specific with the method totalCost invoking those parameters at print statment:

The totalCost method was replaced by getCost defined locally at the class that will use it.

After declaring the method, change the print statement accordingly:

   System.out.println("  ...   + " Cost: " + package1.getCost() + " "); // removed package1.totalCost

Insted of:

   System.out.println("Package 1: Sender: " +  ...  + " Cost: "  + dollar.format(package1.totalCost) +" "); 

The same way goes for the the other packages 2 and 3.

Each one will have a method to calculate cost on its own.

package2 can have the getFlatFee and  package3, the getOvernightFee.

 

 


Search our site

Questions

Login above to
see classes

About us

We are a website where students can find answers to unique questions from their classes.