Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
AI Chat Bot for Websites
sajith.xp.pk
Updated:
Thursday at 1:17 PM
Puffin Rock Characters Plush Toy Set
anil1961
Updated:
Nov 7, 2026
Toyota Vitz scp10 For Sale
Lakmal Bandara
Updated:
Nov 4, 2026
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Nov 2, 2026
Windows RDP Only Rs.500 a month
Blogerwiki
Updated:
Nov 1, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
NEED HELP..!!! C++ wikara
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="yrollgayanth" data-source="post: 7596796" data-attributes="member: 121733"><p>Machan here is a part of the code, but this is done by java. U can use same method in C++ by changing few syntax. i'll put the rest soon</p><p></p><p>[CODE]package average;</p><p></p><p>import java.util.Scanner;</p><p></p><p>public class Main {</p><p></p><p> public static void main(String[] args) {</p><p></p><p> Scanner in = new Scanner(System.in);</p><p> double T1, T2, T3, T4;</p><p></p><p> // Test 1 of 30%</p><p> System.out.print("Please enter test 1 marks :");</p><p> T1 = in.nextDouble();</p><p></p><p></p><p> while (T1 > 100 || T1 < 0) {</p><p> System.out.print("Invalid.Please re-enter test 1 marks :");</p><p> T1 = in.nextDouble();</p><p> }</p><p></p><p> // Test 2 of 30%</p><p> System.out.print("Please enter test 2 marks :");</p><p> T2 = in.nextDouble();</p><p></p><p> while (T2 > 100 || T2 < 0) {</p><p> System.out.print("Invalid.Please re-enter test 2 marks :");</p><p> T2 = in.nextDouble();</p><p> }</p><p></p><p> //Test 3 of 30%</p><p> System.out.print("Please enter test 3 marks :");</p><p> T3 = in.nextDouble();</p><p></p><p></p><p> while (T3 > 100 || T3 < 0) {</p><p> System.out.print("Invalid.Please re-enter test 3 marks :");</p><p> T3 = in.nextDouble();</p><p> }</p><p></p><p> //Test 4 of 30%</p><p> System.out.print("Please enter test 4 marks :");</p><p> T4 = in.nextDouble();</p><p></p><p> while (T4 > 100 || T4 < 0) {</p><p> System.out.print("Invalid.Please re-enter test 4 marks :");</p><p> T4 = in.nextDouble();</p><p> }</p><p></p><p> // Calculate the final for 1st four tests</p><p> double final1 = ((T1 + T2 + T3 + T4) / 4) * 0.3;</p><p></p><p> System.out.println("Grade from first 4 tests:" + final1 + "%");</p><p></p><p></p><p> // Mid term test</p><p> System.out.print("Please enter mid-term test marks :");</p><p> double midT = in.nextDouble();</p><p></p><p> while (midT > 100 || midT < 0) {</p><p> System.out.print("Invalid.Please re-enter mid-term marks :");</p><p> midT = in.nextDouble();</p><p> }</p><p></p><p> double midTper = midT * 0.2;</p><p> System.out.println("Mid term test percentage:" + midTper);</p><p></p><p> // Final term test</p><p> System.out.print("Please enter final test marks :");</p><p> double finalT = in.nextDouble();</p><p></p><p> while (finalT > 100 || finalT < 0) {</p><p> System.out.print("Invalid.Please re-enter final tests marks :");</p><p> }</p><p></p><p> double finalper = finalT * 0.2;</p><p> System.out.print("Final test percentage :" + finalper);</p><p></p><p></p><p></p><p> }</p><p>}</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="yrollgayanth, post: 7596796, member: 121733"] Machan here is a part of the code, but this is done by java. U can use same method in C++ by changing few syntax. i'll put the rest soon [CODE]package average; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); double T1, T2, T3, T4; // Test 1 of 30% System.out.print("Please enter test 1 marks :"); T1 = in.nextDouble(); while (T1 > 100 || T1 < 0) { System.out.print("Invalid.Please re-enter test 1 marks :"); T1 = in.nextDouble(); } // Test 2 of 30% System.out.print("Please enter test 2 marks :"); T2 = in.nextDouble(); while (T2 > 100 || T2 < 0) { System.out.print("Invalid.Please re-enter test 2 marks :"); T2 = in.nextDouble(); } //Test 3 of 30% System.out.print("Please enter test 3 marks :"); T3 = in.nextDouble(); while (T3 > 100 || T3 < 0) { System.out.print("Invalid.Please re-enter test 3 marks :"); T3 = in.nextDouble(); } //Test 4 of 30% System.out.print("Please enter test 4 marks :"); T4 = in.nextDouble(); while (T4 > 100 || T4 < 0) { System.out.print("Invalid.Please re-enter test 4 marks :"); T4 = in.nextDouble(); } // Calculate the final for 1st four tests double final1 = ((T1 + T2 + T3 + T4) / 4) * 0.3; System.out.println("Grade from first 4 tests:" + final1 + "%"); // Mid term test System.out.print("Please enter mid-term test marks :"); double midT = in.nextDouble(); while (midT > 100 || midT < 0) { System.out.print("Invalid.Please re-enter mid-term marks :"); midT = in.nextDouble(); } double midTper = midT * 0.2; System.out.println("Mid term test percentage:" + midTper); // Final term test System.out.print("Please enter final test marks :"); double finalT = in.nextDouble(); while (finalT > 100 || finalT < 0) { System.out.print("Invalid.Please re-enter final tests marks :"); } double finalper = finalT * 0.2; System.out.print("Final test percentage :" + finalper); } } [/CODE] [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom