Convert to C++dotNet, C#, Java #include <iostream> #include <string> #include <a
ID: 3726014 • Letter: C
Question
Convert to C++dotNet, C#, Java
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
int main()
{
//declare variables and arrays
int points = 0;
int minPoints[] = {450, 400, 350, 300, 0};
string letterGrade[] = {"A", "B", "C", "D", "F"};
//get input from user
cout << "Enter student points, 0-500 (-99 to exit): ";
cin >> points;
while (points != -99)
{
int x = 0;
while (points < minPoints[x])
{
x += 1;
}//end while
cout << "A student with " << points <<
" total points earns letter grade " << letterGrade[x] << endl;
cout << " Enter student points, 0-500 (-99 to exit): ";
cin >> points;
}//end while
}//end main
Explanation / Answer
c# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
int[] minPoints = {450, 400, 350, 300, 0};
string[] letterGrade = {"A", "B", "C", "D", "F"};
int points;
Console.Write(" Enter student points, 0-500 (-99 to exit)");
points = Convert.ToInt32(Console.ReadLine());
while (points != -99)
{
int x = 0;
while (points < minPoints[x])
{
x += 1;
}
Console.Write(" A student with "+points+" total points earns letter grade "+ letterGrade[x]);
Console.Write(" Enter student points, 0-500 (-99 to exit)");
points = Convert.ToInt32(Console.ReadLine());
}
}
}
}
C++ code you have already written in ques
java code
import java.util.Scanner;
public class Points {
public static void main(String args[]) {
int minPoints[] = {450, 400, 350, 300, 0};
String letterGrade[] = {"A", "B", "C", "D", "F"};
Scanner sc = new Scanner(System.in);
int points;
System.out.println("Enter student points, 0-500 (-99 to exit):");
points = sc.nextInt();
while (points != -99)
{
int x = 0;
while (points < minPoints[x])
{
x += 1;
}
System.out.println("A student with "+ points + " total points earns letter grade " +letterGrade[x] );
System.out.println(" Enter student points, 0-500 (-99 to exit): ");
points = sc.nextInt();
}
}
}