Austin9675
Austin9675
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
When you use 20 / 100 or 5 / 100, the result will be truncated to an integer in C# because both operands are integers. you should use floating-point literals or explicitly cast one of the operands to a double
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
theres plenty of times where i cant figure something out, thats why im in this discord
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
trust me coding isnt easy it isnt really meant to be
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
this works 100% for me
int textbook;
char cover;
double rprice;
double fprice = 0; // Initialize fprice to 0

Console.WriteLine("Enter number of books");
textbook = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Do you want hardback? y/n");
cover = Convert.ToChar(Console.ReadLine());

rprice = textbook * 125;

if (cover == 'y' && textbook > 4)
{
double discount = 0.20; // 20% discount
double tax = 0.05; // 5% tax

fprice = rprice - (discount * rprice) + (tax * rprice);
Console.WriteLine(fprice);
}
else if (cover == 'n' && textbook > 4)
{
fprice = rprice - (0.05 * rprice);
Console.WriteLine(fprice);
}
else if (cover == 'y' && textbook <= 4)
{
fprice = rprice + (0.20 * rprice);
Console.WriteLine(fprice);
}
else
{
fprice = rprice;
Console.WriteLine(fprice);
}
int textbook;
char cover;
double rprice;
double fprice = 0; // Initialize fprice to 0

Console.WriteLine("Enter number of books");
textbook = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Do you want hardback? y/n");
cover = Convert.ToChar(Console.ReadLine());

rprice = textbook * 125;

if (cover == 'y' && textbook > 4)
{
double discount = 0.20; // 20% discount
double tax = 0.05; // 5% tax

fprice = rprice - (discount * rprice) + (tax * rprice);
Console.WriteLine(fprice);
}
else if (cover == 'n' && textbook > 4)
{
fprice = rprice - (0.05 * rprice);
Console.WriteLine(fprice);
}
else if (cover == 'y' && textbook <= 4)
{
fprice = rprice + (0.20 * rprice);
Console.WriteLine(fprice);
}
else
{
fprice = rprice;
Console.WriteLine(fprice);
}
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
nothing thats how they wanted me to post the code
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
int textbook;
char cover;
double rprice;
double fprice;

Console.WriteLine("Enter number of books");
textbook = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Do you want hardback? y/n");
cover = Convert.ToChar(Console.ReadLine());

rprice = textbook * 125;

if (cover == 'y' && textbook > 4)
{
double discount = 0.20; // 20% discount
double tax = 0.05; // 5% tax

fprice = rprice - (discount * rprice) + (tax * rprice);
Console.WriteLine(fprice);
}
int textbook;
char cover;
double rprice;
double fprice;

Console.WriteLine("Enter number of books");
textbook = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Do you want hardback? y/n");
cover = Convert.ToChar(Console.ReadLine());

rprice = textbook * 125;

if (cover == 'y' && textbook > 4)
{
double discount = 0.20; // 20% discount
double tax = 0.05; // 5% tax

fprice = rprice - (discount * rprice) + (tax * rprice);
Console.WriteLine(fprice);
}
and yes variables is how i got the progam to work, i was running into the same issue
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
this is how it works for me int textbook; char cover; double rprice; double fprice; Console.WriteLine("Enter number of books"); textbook = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Do you want hardback? y/n"); cover = Convert.ToChar(Console.ReadLine()); rprice = textbook * 125; if (cover == 'y' && textbook > 4) { double discount = 0.20; // 20% discount double tax = 0.05; // 5% tax fprice = rprice - (discount * rprice) + (tax * rprice); Console.WriteLine(fprice); }
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
1062.5 the problem is how you have ur code
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
its still working fine for me , i have not ran into any issues, using 10 and hitting y prints the first statement for me
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
hold on i misread ill try it again
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
you gotta be typing something wrong because i recreated ur code and it works fine for me
65 replies
CC#
Created by Chinpoki on 2/1/2024 in #help
If statements
Are you using capital Y or N instead of lowercase ?
65 replies
CC#
Created by Austin9675 on 1/28/2024 in #help
Unity Error
yeah
13 replies
CC#
Created by Austin9675 on 1/28/2024 in #help
Unity Error
im trying to install a editor so i can even get started to create a project, its worked before but i dont remember exactly why i had to re download unity or update unity and it just doesn't work anymore
13 replies
CC#
Created by Austin9675 on 1/28/2024 in #help
Unity Error
and you don't think google was my first option 💀 thats why im here
13 replies
CC#
Created by Austin9675 on 1/24/2024 in #help
Finding a game file
private void step2Button_Click(object sender, EventArgs e) { string userHomePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string palServerRelativePath = Path.Combine("Program Files (x86)", "Steam", "steamapps", "common", "PalServer", "Pal", "Saved", "Config", "WindowsServer"); string palServerConfigPath = Path.Combine(userHomePath, palServerRelativePath); string fileName = "PalWorldSettings.config"; string filePath = Path.Combine(palServerConfigPath, fileName); if (!Directory.Exists(palServerConfigPath)) { Console.WriteLine($"Directory not found: {palServerConfigPath}"); }
if (File.Exists(filePath)) { using (StreamWriter sw = new StreamWriter(palServerConfigPath)) { sw.WriteLine("[/Script/Pal.PalGameWorldSettings]"); sw.WriteLine("OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAli"); sw.WriteLine(@"veMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName=""Default Palworld Server"",ServerDescription="""",AdminPassword="""",ServerPassword="""",PublicPort=8211,PublicIP="""",RCONEnabled=False,RCONPort=25575,Region="""",bUseAuth=True,BanListURL=""https://api.palworldgame.com/api/banlist.txt"""); } } else { MessageBox.Show($"{fileName} cannot be found, you must download PalWorld Dedicated Servers on steam!", "File not found"); } }
2 replies
CC#
Created by Austin9675 on 1/19/2024 in #help
File writing
i fixed it, instead of a + in needed a , so string vehicleFile = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "VehicleChecklist.txt");
4 replies
CC#
Created by Austin9675 on 1/2/2024 in #help
working with System IO
ignore i ever made this im dumb
8 replies