Jump to content

Code help.

duckwithanokhat

So I have thing called "labs" in my comp. sci class. Here is my current lab (learning C code, no C++):

https://gyazo.com/7205051534b16db21e6f1337312c778f

 

It says to determine whether a customer has exceeded the store credit. My theory would be to use an if statement but the problem is we haven't learned what an if statement is yet, and the labs should be done with the knowledge I have been taught with. So is there another way to determine whether or not a customer has exceeded store credit?

 

Oh yeah, also how does a store credit system work?

Link to comment
Share on other sites

Link to post
Share on other sites

There's no intelligent way to do it without an if....so I'm sure you can use an if statement. 

 

Its simple: 


if(statement == true){

    do this;

} else { 

     do this; 

}

 

A store credit -- you have x amount that you're allowed to spend until you pay it off. 

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, djdwosk97 said:

There's no intelligent way to do it without an if....so I'm sure you can use an if statement. 

 

Its simple: 

if(statement == true){

    do this;

} else { 

     do this; 

}

 

A store credit -- you have x amount that you're allowed to spend until you pay it off. 

So in my example, how would you calculate new account balance and credit remaining?

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, duckwithanokhat said:

So in my example, how would you calculate new account balance and credit remaining?

account balance = previous month's balance + this months charges. Then check if that number exceeds the maximum credit limit 

 

Credit remaining would just be max credit - account balance.

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, djdwosk97 said:

account balance = previous month's balance + this months charges. Then check if that number exceeds the maximum credit limit 

 

Credit remaining would just be max credit - account balance.

But would payments affect the account balance (assuming payments mean that the customer is paying off the credits)? So wouldn't it be 
account balance = start balance + charge - payments?
 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, duckwithanokhat said:

But would payments affect the account balance (assuming payments mean that the customer is paying off the credits)? So wouldn't it be 
account balance = start balance + charge - payments?
 

Whoops, missed that, and yes they would. 

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×